Package org.nuxeo.ecm.core.api.impl.blob
Class ByteArrayBlob
- java.lang.Object
-
- org.nuxeo.ecm.core.api.impl.blob.AbstractBlob
-
- org.nuxeo.ecm.core.api.impl.blob.ByteArrayBlob
-
- All Implemented Interfaces:
Serializable,Blob
public class ByteArrayBlob extends AbstractBlob implements Serializable
Blob based on a byte array.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]bytes-
Fields inherited from class org.nuxeo.ecm.core.api.impl.blob.AbstractBlob
digest, digestAlgorithm, encoding, filename, mimeType, TEXT_PLAIN, UTF_8
-
-
Constructor Summary
Constructors Constructor Description ByteArrayBlob(byte[] bytes)ByteArrayBlob(byte[] bytes, String mimeType)ByteArrayBlob(byte[] bytes, String mimeType, String encoding)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getByteArray()longgetLength()Gets the data length in bytes if known.InputStreamgetStream()Gets anInputStreamfor the data of this blob.StringgetString()-
Methods inherited from class org.nuxeo.ecm.core.api.impl.blob.AbstractBlob
equals, equalsStream, getCloseableFile, getCloseableFile, getDigest, getDigestAlgorithm, getEncoding, getFile, getFilename, getMimeType, hashCode, setDigest, setDigestAlgorithm, setEncoding, setFilename, setMimeType, transferTo, transferTo
-
-
-
-
Method Detail
-
getLength
public long getLength()
Description copied from interface:BlobGets the data length in bytes if known.- Specified by:
getLengthin interfaceBlob- Overrides:
getLengthin classAbstractBlob- Returns:
- the data length or -1 if not known
-
getStream
public InputStream getStream()
Description copied from interface:BlobGets anInputStreamfor the data of this blob.The contract of
Blobis that this method can be called several times and will correctly return a newInputStreameach time. In other words, several reads of theBlobcan be done.Like all
InputStream, the result must be closed when done with it to avoid resource leaks.
-
getByteArray
public byte[] getByteArray()
- Specified by:
getByteArrayin interfaceBlob- Overrides:
getByteArrayin classAbstractBlob
-
getString
public String getString() throws IOException
- Specified by:
getStringin interfaceBlob- Overrides:
getStringin classAbstractBlob- Throws:
IOException
-
-