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
Fields inherited from class org.nuxeo.ecm.core.api.impl.blob.AbstractBlob
digest, digestAlgorithm, encoding, filename, mimeType, TEXT_PLAIN, UTF_8
-
Constructor Summary
ConstructorDescriptionByteArrayBlob
(byte[] bytes) ByteArrayBlob
(byte[] bytes, String mimeType) ByteArrayBlob
(byte[] bytes, String mimeType, String encoding) -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
long
Gets the data length in bytes if known.Gets anInputStream
for 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:Blob
Gets the data length in bytes if known.- Specified by:
getLength
in interfaceBlob
- Overrides:
getLength
in classAbstractBlob
- Returns:
- the data length or -1 if not known
-
getStream
Description copied from interface:Blob
Gets anInputStream
for the data of this blob.The contract of
Blob
is that this method can be called several times and will correctly return a newInputStream
each time. In other words, several reads of theBlob
can be done.Like all
InputStream
, the result must be closed when done with it to avoid resource leaks. -
getByteArray
public byte[] getByteArray()- Specified by:
getByteArray
in interfaceBlob
- Overrides:
getByteArray
in classAbstractBlob
-
getString
- Specified by:
getString
in interfaceBlob
- Overrides:
getString
in classAbstractBlob
- Throws:
IOException
-