Package org.nuxeo.ecm.core.api.impl.blob
Class BlobWrapper
java.lang.Object
org.nuxeo.ecm.core.api.impl.blob.BlobWrapper
- All Implemented Interfaces:
Serializable,Blob
Wraps an existing
Blob to allow setting a different filename.- Since:
- 5.9.2
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]Gets aCloseableFilebacking this blob, which must be closed when done by the caller.getCloseableFile(String ext) Gets aCloseableFilebacking this blob, which must be closed when done by the caller.getFile()If this blob is backed by an actual file, returns it.longGets the data length in bytes if known.Gets anInputStreamfor the data of this blob.voidvoidsetDigestAlgorithm(String digestAlgorithm) voidsetEncoding(String encoding) voidsetFilename(String filename) voidsetMimeType(String mimeType) voidtransferTo(File file) voidtransferTo(OutputStream out)
-
Field Details
-
blob
-
filename
-
-
Constructor Details
-
BlobWrapper
-
-
Method Details
-
getFilename
- Specified by:
getFilenamein interfaceBlob
-
setFilename
- Specified by:
setFilenamein interfaceBlob
-
getMimeType
- Specified by:
getMimeTypein interfaceBlob
-
getEncoding
- Specified by:
getEncodingin interfaceBlob
-
getDigestAlgorithm
- Specified by:
getDigestAlgorithmin interfaceBlob
-
getDigest
-
setMimeType
- Specified by:
setMimeTypein interfaceBlob
-
setEncoding
- Specified by:
setEncodingin interfaceBlob
-
setDigestAlgorithm
- Specified by:
setDigestAlgorithmin interfaceBlob
-
setDigest
-
getStream
Description copied from interface:BlobGets anInputStreamfor the data of this blob.The contract of
Blobis that this method can be called several times and will correctly return a newInputStreameach time. In other words, several reads of theBlobcan be done.Like all
InputStream, the result must be closed when done with it to avoid resource leaks.- Specified by:
getStreamin interfaceBlob- Returns:
- the stream
- Throws:
IOException
-
getLength
public long getLength()Description copied from interface:BlobGets the data length in bytes if known. -
getByteArray
- Specified by:
getByteArrayin interfaceBlob- Throws:
IOException
-
getString
- Specified by:
getStringin interfaceBlob- Throws:
IOException
-
transferTo
- Specified by:
transferToin interfaceBlob- Throws:
IOException
-
transferTo
- Specified by:
transferToin interfaceBlob- Throws:
IOException
-
getFile
Description copied from interface:BlobIf this blob is backed by an actual file, returns it.The returned file may be short-lived (temporary), so should be used immediately.
-
getCloseableFile
Description copied from interface:BlobGets aCloseableFilebacking 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.
- Specified by:
getCloseableFilein interfaceBlob- Returns:
- a closeable file, to be closed when done
- Throws:
IOException
-
getCloseableFile
Description copied from interface:BlobGets aCloseableFilebacking 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.
- Specified by:
getCloseableFilein interfaceBlob- Parameters:
ext- the required extension for the file, ornullif it doesn't matter- Returns:
- a closeable file, to be closed when done
- Throws:
IOException
-