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
Blob based on a byte array.
- See Also:
-
Field Summary
FieldsFields inherited from class org.nuxeo.ecm.core.api.impl.blob.AbstractBlob
digest, digestAlgorithm, encoding, filename, mimeType, TEXT_PLAIN, UTF_8 -
Constructor Summary
ConstructorsConstructorDescriptionByteArrayBlob(byte[] bytes) ByteArrayBlob(byte[] bytes, String mimeType) ByteArrayBlob(byte[] bytes, String mimeType, String encoding) -
Method Summary
Modifier and TypeMethodDescriptionbyte[]longGets the data length in bytes if known.Gets anInputStreamfor the data of this blob.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
-
Field Details
-
bytes
protected final byte[] bytes
-
-
Constructor Details
-
ByteArrayBlob
public ByteArrayBlob(byte[] bytes) -
ByteArrayBlob
-
ByteArrayBlob
-
-
Method Details
-
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
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
- Specified by:
getStringin interfaceBlob- Overrides:
getStringin classAbstractBlob- Throws:
IOException
-