public class BlobWrapper extends Object implements Blob, Serializable
Blob to allow setting a different filename.| Modifier and Type | Field and Description | 
|---|---|
protected Blob | 
blob  | 
protected String | 
filename  | 
| Constructor and Description | 
|---|
BlobWrapper(Blob blob)  | 
| Modifier and Type | Method and Description | 
|---|---|
byte[] | 
getByteArray()  | 
CloseableFile | 
getCloseableFile()
Gets a  
CloseableFile backing this blob, which must be closed when done by the caller. | 
CloseableFile | 
getCloseableFile(String ext)
Gets a  
CloseableFile backing this blob, which must be closed when done by the caller. | 
String | 
getDigest()  | 
String | 
getDigestAlgorithm()  | 
String | 
getEncoding()  | 
File | 
getFile()
If this blob is backed by an actual file, returns it. 
 | 
String | 
getFilename()  | 
long | 
getLength()
Gets the data length in bytes if known. 
 | 
String | 
getMimeType()  | 
InputStream | 
getStream()
Gets an  
InputStream for the data of this blob. | 
String | 
getString()  | 
void | 
setDigest(String digest)  | 
void | 
setEncoding(String encoding)  | 
void | 
setFilename(String filename)  | 
void | 
setMimeType(String mimeType)  | 
void | 
transferTo(File file)  | 
void | 
transferTo(OutputStream out)  | 
public BlobWrapper(Blob blob)
public String getFilename()
getFilename in interface Blobpublic void setFilename(String filename)
setFilename in interface Blobpublic String getMimeType()
getMimeType in interface Blobpublic String getEncoding()
getEncoding in interface Blobpublic String getDigestAlgorithm()
getDigestAlgorithm in interface Blobpublic void setMimeType(String mimeType)
setMimeType in interface Blobpublic void setEncoding(String encoding)
setEncoding in interface Blobpublic InputStream getStream() throws IOException
BlobInputStream 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 BlobIOExceptionpublic long getLength()
Blobpublic byte[] getByteArray() throws IOException
getByteArray in interface BlobIOExceptionpublic String getString() throws IOException
getString in interface BlobIOExceptionpublic void transferTo(OutputStream out) throws IOException
transferTo in interface BlobIOExceptionpublic void transferTo(File file) throws IOException
transferTo in interface BlobIOExceptionpublic File getFile()
BlobThe returned file may be short-lived (temporary), so should be used immediately.
public CloseableFile getCloseableFile() throws IOException
BlobCloseableFile backing this blob, which must be closed when done by the caller.
 The returned file may be the original file, a temporary file, or a symbolic link.
getCloseableFile in interface BlobIOExceptionpublic CloseableFile getCloseableFile(String ext) throws IOException
BlobCloseableFile backing this blob, which must be closed when done by the caller.
 The returned file may be the original file, a temporary file, or a symbolic link.
getCloseableFile in interface Blobext - the required extension for the file, or null if it doesn't matterIOExceptionCopyright © 2019 Nuxeo. All rights reserved.