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 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
createBlob(InputStream in)
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
createBlobWithExtension(String ext)
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 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 aBlob
backed by the given bytes array.- Parameters:
bytes
- the bytes array
-
createBlob
public static Blob createBlob(byte[] bytes, String mimeType) throws IOException
Creates aBlob
backed 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 aBlob
backed 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 aBlob
backed 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 aBlob
backed 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 aBlob
backed 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 aBlob
backed by the given string.- Parameters:
string
- the stringmimeType
- the MIME typeencoding
- the encodingfilename
- the blob filename
-
createJSONBlob
public static Blob createJSONBlob(String json)
Create aBlob
backed by the given JSON string.- Parameters:
json
- the JSON string- Since:
- 9.2
-
createJSONBlobFromValue
public static Blob createJSONBlobFromValue(Object value) throws IOException
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
-
-