Package org.nuxeo.ecm.core.api
Class Blobs
- java.lang.Object
-
- org.nuxeo.ecm.core.api.Blobs
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 BlobcreateBlob(InputStream in)Creates 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 BlobcreateBlobWithExtension(String ext)static BlobcreateJSONBlob(String json)Create aBlobbacked by the given JSON string.static BlobcreateJSONBlobFromValue(Object value)Create aBlobbacked by the JSON for an arbitrary value.
-
-
-
Method Detail
-
createBlob
public static Blob createBlob(File file) throws IOException
- Parameters:
file- file- Throws:
IOException
-
createBlob
public static Blob createBlob(File file, String mimeType) throws IOException
- Parameters:
file- filemimeType- the MIME type- Throws:
IOException
-
createBlob
public static Blob createBlob(File file, String mimeType, String encoding) throws IOException
- 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
public static Blob createBlobWithExtension(String ext) throws IOException
- Parameters:
ext- the extension- Throws:
IOException
-
createBlob
public static Blob createBlob(InputStream in) throws IOException
- Parameters:
in- the input stream, which is closed after use- Throws:
IOException
-
createBlob
public static Blob createBlob(InputStream in, String mimeType) throws IOException
- Parameters:
in- the input stream, which is closed after usemimeType- the MIME type- Throws:
IOException
-
createBlob
public static Blob createBlob(InputStream in, String mimeType, String encoding) throws IOException
- 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
public static Blob createBlob(byte[] bytes)
Creates aBlobbacked by the given bytes array.- Parameters:
bytes- the bytes array
-
createBlob
public static Blob createBlob(byte[] bytes, String mimeType) throws IOException
Creates aBlobbacked by the given bytes array.- Parameters:
bytes- the bytes arraymimeType- the MIME type- Throws:
IOException
-
createBlob
public static Blob createBlob(byte[] bytes, String mimeType, String encoding) throws IOException
Creates aBlobbacked by the given bytes array.- Parameters:
bytes- the bytes arraymimeType- the MIME typeencoding- the encoding- Throws:
IOException
-
createBlob
public static Blob createBlob(String string)
Creates aBlobbacked by the given string, with MIME type "text/plain" and encoding "UTF-8".- Parameters:
string- the string
-
createBlob
public static Blob createBlob(String string, String mimeType)
Creates aBlobbacked by the given string, with encoding "UTF-8".- Parameters:
string- the stringmimeType- the MIME type
-
createBlob
public static Blob createBlob(String string, String mimeType, String encoding)
Creates aBlobbacked by the given string.- Parameters:
string- the stringmimeType- the MIME typeencoding- the encoding
-
createBlob
public static Blob createBlob(String string, String mimeType, String encoding, String filename)
Creates aBlobbacked by the given string.- Parameters:
string- the stringmimeType- the MIME typeencoding- the encodingfilename- the blob filename
-
createJSONBlob
public static Blob createJSONBlob(String json)
Create aBlobbacked by the given JSON string.- Parameters:
json- the JSON string- Since:
- 9.2
-
createJSONBlobFromValue
public static Blob createJSONBlobFromValue(Object value) throws IOException
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
-
-