Package org.nuxeo.ecm.core.api
Class Blobs
java.lang.Object
org.nuxeo.ecm.core.api.Blobs
This class consists exclusively of static methods that operate on
Blobs.-
Method Summary
Modifier and TypeMethodDescriptionstatic BlobcreateBlob(byte[] bytes) Creates aBlobbacked by the given bytes array.static BlobcreateBlob(byte[] bytes, String mimeType) Creates aBlobbacked by the given bytes array.static BlobcreateBlob(byte[] bytes, String mimeType, String encoding) Creates aBlobbacked by the given bytes array.static BlobcreateBlob(File file) static BlobcreateBlob(File file, String mimeType) static BlobcreateBlob(File file, String mimeType, String encoding) static BlobcreateBlob(File file, String mimeType, String encoding, String filename) static BlobCreates aBlobfrom anInputStream, by saving it to a temporary file.static BlobcreateBlob(InputStream in, String mimeType) Creates aBlobfrom anInputStream, by saving it to a temporary file.static BlobcreateBlob(InputStream in, String mimeType, String encoding) Creates aBlobfrom anInputStream, by saving it to a temporary file.static BlobcreateBlob(InputStream in, String mimeType, String encoding, File tmpDir) Creates aBlobfrom anInputStream, by saving it to a temporary file.static BlobcreateBlob(String string) Creates aBlobbacked by the given string, with MIME type "text/plain" and encoding "UTF-8".static BlobcreateBlob(String string, String mimeType) Creates aBlobbacked by the given string, with encoding "UTF-8".static BlobcreateBlob(String string, String mimeType, String encoding) Creates aBlobbacked by the given string.static BlobcreateBlob(String string, String mimeType, String encoding, String filename) Creates aBlobbacked by the given string.static Blobstatic BlobcreateJSONBlob(String json) Create aBlobbacked by the given JSON string.static BlobcreateJSONBlobFromValue(Object value) Create aBlobbacked by the JSON for an arbitrary value.
-
Method Details
-
createBlob
- Parameters:
file- file- Throws:
IOException
-
createBlob
- Parameters:
file- filemimeType- the MIME type- Throws:
IOException
-
createBlob
- Parameters:
file- filemimeType- the MIME typeencoding- the encoding- Throws:
IOException
-
createBlob
public static Blob createBlob(File file, String mimeType, String encoding, String filename) throws IOException - Parameters:
file- filemimeType- the MIME typeencoding- the encodingfilename- the blob filename- Throws:
IOException
-
createBlobWithExtension
- Parameters:
ext- the extension- Throws:
IOException
-
createBlob
- Parameters:
in- the input stream, which is closed after use- Throws:
IOException
-
createBlob
- Parameters:
in- the input stream, which is closed after usemimeType- the MIME type- Throws:
IOException
-
createBlob
- Parameters:
in- the input stream, which is closed after usemimeType- the MIME typeencoding- the encoding- Throws:
IOException
-
createBlob
public static Blob createBlob(InputStream in, String mimeType, String encoding, File tmpDir) throws IOException - Parameters:
in- the input stream, which is closed after usemimeType- the MIME typeencoding- the encodingtmpDir- the temporary directory for file creation- Throws:
IOException
-
createBlob
Creates aBlobbacked by the given bytes array.- Parameters:
bytes- the bytes array
-
createBlob
Creates aBlobbacked by the given bytes array.- Parameters:
bytes- the bytes arraymimeType- the MIME type- Throws:
IOException
-
createBlob
Creates aBlobbacked by the given bytes array.- Parameters:
bytes- the bytes arraymimeType- the MIME typeencoding- the encoding- Throws:
IOException
-
createBlob
Creates aBlobbacked by the given string, with MIME type "text/plain" and encoding "UTF-8".- Parameters:
string- the string
-
createBlob
Creates aBlobbacked by the given string, with encoding "UTF-8".- Parameters:
string- the stringmimeType- the MIME type
-
createBlob
Creates aBlobbacked by the given string.- Parameters:
string- the stringmimeType- the MIME typeencoding- the encoding
-
createBlob
Creates aBlobbacked by the given string.- Parameters:
string- the stringmimeType- the MIME typeencoding- the encodingfilename- the blob filename
-
createJSONBlob
Create aBlobbacked by the given JSON string.- Parameters:
json- the JSON string- Since:
- 9.2
-
createJSONBlobFromValue
Create aBlobbacked by the JSON for an arbitrary value.The value's internal classes may be annotated with Jackson 2 annotations.
- Parameters:
value- the value- Throws:
IOException- Since:
- 9.2
-