Package org.nuxeo.ecm.core.blob.binary
Class BinaryBlob
- java.lang.Object
-
- org.nuxeo.ecm.core.api.impl.blob.AbstractBlob
-
- org.nuxeo.ecm.core.blob.binary.BinaryBlob
-
- All Implemented Interfaces:
Serializable
,Blob
,ManagedBlob
public class BinaryBlob extends AbstractBlob implements ManagedBlob, Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Binary
binary
protected String
key
The key, which is the binary's digest but may in addition be prefixed by a blob provider id.protected long
length
-
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 BinaryBlob(Binary binary, String key, String filename, String mimeType, String encoding, String digest, long length)
Deprecated.since 11.5, use signature with digestAlgorithm insteadBinaryBlob(Binary binary, String key, String filename, String mimeType, String encoding, String digestAlgorithm, String digest, long length)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
equalsStream(Blob blob)
Binary
getBinary()
Gets theBinary
attached to this blob.File
getFile()
If this blob is backed by an actual file, returns it.String
getKey()
Gets the stored representation of this blob.long
getLength()
Gets the data length in bytes if known.String
getProviderId()
Gets the id of theBlobProvider
managing this blob.InputStream
getStream()
Gets anInputStream
for the data of this blob.-
Methods inherited from class org.nuxeo.ecm.core.api.impl.blob.AbstractBlob
equals, getByteArray, getCloseableFile, getCloseableFile, getDigest, getDigestAlgorithm, getEncoding, getFilename, getMimeType, getString, hashCode, setDigest, setDigestAlgorithm, setEncoding, setFilename, setMimeType, transferTo, transferTo
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.ecm.core.api.Blob
getByteArray, getCloseableFile, getCloseableFile, getDigest, getDigestAlgorithm, getEncoding, getFilename, getMimeType, getString, setDigest, setDigestAlgorithm, setEncoding, setFilename, setMimeType, transferTo, transferTo
-
-
-
-
Method Detail
-
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
public InputStream getStream() throws IOException
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.- Specified by:
getStream
in interfaceBlob
- Specified by:
getStream
in interfaceManagedBlob
- Returns:
- the stream
- Throws:
IOException
-
getBinary
public Binary getBinary()
Gets theBinary
attached to this blob.- Returns:
- the binary
- Since:
- 5.9.4
-
getKey
public String getKey()
Description copied from interface:ManagedBlob
Gets the stored representation of this blob.- Specified by:
getKey
in interfaceManagedBlob
- Returns:
- the stored representation
-
getProviderId
public String getProviderId()
Description copied from interface:ManagedBlob
Gets the id of theBlobProvider
managing this blob.- Specified by:
getProviderId
in interfaceManagedBlob
- Returns:
- the blob provider id
-
getFile
public File getFile()
Description copied from interface:Blob
If this blob is backed by an actual file, returns it.The returned file may be short-lived (temporary), so should be used immediately.
- Specified by:
getFile
in interfaceBlob
- Specified by:
getFile
in interfaceManagedBlob
- Overrides:
getFile
in classAbstractBlob
- Returns:
- a file, or
null
if the blob is not backed by a file
-
equalsStream
protected boolean equalsStream(Blob blob)
- Overrides:
equalsStream
in classAbstractBlob
-
-