public class BinaryBlob extends AbstractBlob implements ManagedBlob, Serializable
Modifier and Type | Field and 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 |
digest, encoding, filename, mimeType, TEXT_PLAIN, UTF_8
Constructor and Description |
---|
BinaryBlob(Binary binary,
String key,
String filename,
String mimeType,
String encoding,
String digest,
long length) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
equalsStream(Blob blob) |
Binary |
getBinary()
Gets the
Binary attached to this blob. |
String |
getDigest() |
String |
getDigestAlgorithm() |
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 the
BlobProvider managing this blob. |
InputStream |
getStream()
Gets an
InputStream for the data of this blob. |
equals, getByteArray, getCloseableFile, getCloseableFile, getEncoding, getFilename, getMimeType, getString, hashCode, setDigest, setEncoding, setFilename, setMimeType, transferTo, transferTo
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getByteArray, getCloseableFile, getCloseableFile, getEncoding, getFilename, getMimeType, getString, setDigest, setEncoding, setFilename, setMimeType, transferTo, transferTo
protected final String key
protected final long length
public long getLength()
Blob
getLength
in interface Blob
getLength
in class AbstractBlob
public InputStream getStream() throws IOException
Blob
InputStream
for the data of this blob.
The contract of Blob
is that this method can be called several times and will correctly return a new
InputStream
each time. In other words, several reads of the Blob
can be done.
Like all InputStream
, the result must be closed when done with it to avoid resource leaks.
getStream
in interface Blob
IOException
public Binary getBinary()
Binary
attached to this blob.public String getDigestAlgorithm()
getDigestAlgorithm
in interface Blob
getDigestAlgorithm
in class AbstractBlob
public String getDigest()
getDigest
in interface Blob
getDigest
in class AbstractBlob
public String getKey()
ManagedBlob
getKey
in interface ManagedBlob
public String getProviderId()
ManagedBlob
BlobProvider
managing this blob.getProviderId
in interface ManagedBlob
public File getFile()
Blob
The returned file may be short-lived (temporary), so should be used immediately.
getFile
in interface Blob
getFile
in class AbstractBlob
null
if the blob is not backed by a fileprotected boolean equalsStream(Blob blob)
equalsStream
in class AbstractBlob
Copyright © 2018 Nuxeo. All rights reserved.