public class LazyBlob extends DefaultStreamBlob implements Serializable
This blob has the limitation you will find in all stream blobs.
Once the stream was acquired there is no more guarantee that another getStream() call will return a valid stream.
This could be fixed by using a temp file to store the stream.
Modifier and Type | Class and Description |
---|---|
static class |
LazyBlob.EmptyInputStream |
Modifier and Type | Field and Description |
---|---|
static InputStream |
EMPTY_INPUT_STREAM |
EMPTY_BYTE_ARRAY, EMPTY_READER, EMPTY_STRING
Constructor and Description |
---|
LazyBlob(InputStream in,
String encoding,
String mimeType,
String sid,
String dataKey,
String repositoryName) |
LazyBlob(InputStream in,
String encoding,
String mimeType,
String sid,
String dataKey,
String repositoryName,
String filename,
String digest,
long length) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
String |
getDataKey() |
long |
getLength()
Gets the data length in bytes if known.
|
String |
getRepositoryName() |
String |
getSid() |
InputStream |
getStream() |
int |
hashCode() |
boolean |
isPersistent()
Checks whether this blob is persistent.
|
Blob |
persist()
Persist this stream so that
Blob.getStream() method can be called
successfully several times. |
void |
reset() |
getDigest, getEncoding, getFilename, getMimeType, setDigest, setEncoding, setFilename, setMimeType
asByteArrayBlob, asStringBlob, getByteArray, getReader, getString, readBytes, readBytes, readString
copy, copy, transferTo, transferTo, transferTo
public static final InputStream EMPTY_INPUT_STREAM
public LazyBlob(InputStream in, String encoding, String mimeType, String sid, String dataKey, String repositoryName, String filename, String digest, long length)
public long getLength()
Blob
getLength
in interface Blob
getLength
in class StreamBlob
public String getSid()
public String getDataKey()
public String getRepositoryName()
public void reset()
public InputStream getStream() throws IOException
getStream
in interface Blob
IOException
public boolean isPersistent()
Blob
Blob.getStream()
can be
successfully called several times).isPersistent
in interface Blob
public Blob persist() throws IOException
Blob
Blob.getStream()
method can be called
successfully several times. The persistence is done in a temporary file
or in memory - this is up to the implementation.
Blobs that are already persistent return themselves.
Persistence should update the internal structure of the Blob to make it persistent whenever possible and hence return itself whenever possible. This behavior cannot be guaranteed by every implementation however.
persist
in interface Blob
IOException
Copyright © 2011 Nuxeo SA. All Rights Reserved.