use of org.sonatype.nexus.repository.view.Content in project nexus-repository-r by sonatype-nexus-community.
the class RFacetUtils method saveAsset.
/**
* Save an asset && create blob.
*
* @return blob content
*/
public static Content saveAsset(final StorageTx tx, final Asset asset, final Supplier<InputStream> contentSupplier, final Payload payload) throws IOException {
AttributesMap contentAttributes = null;
String contentType = null;
if (payload instanceof Content) {
contentAttributes = ((Content) payload).getAttributes();
contentType = payload.getContentType();
}
return saveAsset(tx, asset, contentSupplier, contentType, contentAttributes);
}
use of org.sonatype.nexus.repository.view.Content in project nexus-repository-r by sonatype-nexus-community.
the class RFacetUtils method toContent.
/**
* Convert an asset blob to {@link Content}.
*
* @return content of asset blob
*/
public static Content toContent(final Asset asset, final Blob blob) {
Content content = new Content(new BlobPayload(blob, asset.requireContentType()));
Content.extractFromAsset(asset, HASH_ALGORITHMS, content.getAttributes());
return content;
}
Aggregations