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
Blob
s.-
Method Summary
Modifier and TypeMethodDescriptionstatic Blob
createBlob
(byte[] bytes) Creates aBlob
backed by the given bytes array.static Blob
createBlob
(byte[] bytes, String mimeType) Creates aBlob
backed by the given bytes array.static Blob
createBlob
(byte[] bytes, String mimeType, String encoding) Creates aBlob
backed by the given bytes array.static Blob
createBlob
(File file) static Blob
createBlob
(File file, String mimeType) static Blob
createBlob
(File file, String mimeType, String encoding) static Blob
createBlob
(File file, String mimeType, String encoding, String filename) static Blob
Creates aBlob
from anInputStream
, by saving it to a temporary file.static Blob
createBlob
(InputStream in, String mimeType) Creates aBlob
from anInputStream
, by saving it to a temporary file.static Blob
createBlob
(InputStream in, String mimeType, String encoding) Creates aBlob
from anInputStream
, by saving it to a temporary file.static Blob
createBlob
(InputStream in, String mimeType, String encoding, File tmpDir) Creates aBlob
from anInputStream
, by saving it to a temporary file.static Blob
createBlob
(String string) Creates aBlob
backed by the given string, with MIME type "text/plain" and encoding "UTF-8".static Blob
createBlob
(String string, String mimeType) Creates aBlob
backed by the given string, with encoding "UTF-8".static Blob
createBlob
(String string, String mimeType, String encoding) Creates aBlob
backed by the given string.static Blob
createBlob
(String string, String mimeType, String encoding, String filename) Creates aBlob
backed by the given string.static Blob
static Blob
createJSONBlob
(String json) Create aBlob
backed by the given JSON string.static Blob
createJSONBlobFromValue
(Object value) Create aBlob
backed 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 aBlob
backed by the given bytes array.- Parameters:
bytes
- the bytes array
-
createBlob
Creates aBlob
backed by the given bytes array.- Parameters:
bytes
- the bytes arraymimeType
- the MIME type- Throws:
IOException
-
createBlob
Creates aBlob
backed by the given bytes array.- Parameters:
bytes
- the bytes arraymimeType
- the MIME typeencoding
- the encoding- Throws:
IOException
-
createBlob
Creates aBlob
backed by the given string, with MIME type "text/plain" and encoding "UTF-8".- Parameters:
string
- the string
-
createBlob
Creates aBlob
backed by the given string, with encoding "UTF-8".- Parameters:
string
- the stringmimeType
- the MIME type
-
createBlob
Creates aBlob
backed by the given string.- Parameters:
string
- the stringmimeType
- the MIME typeencoding
- the encoding
-
createBlob
Creates aBlob
backed by the given string.- Parameters:
string
- the stringmimeType
- the MIME typeencoding
- the encodingfilename
- the blob filename
-
createJSONBlob
Create aBlob
backed by the given JSON string.- Parameters:
json
- the JSON string- Since:
- 9.2
-
createJSONBlobFromValue
Create aBlob
backed 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
-