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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
Gets aCloseableFile
backing this blob, which must be closed when done by the caller.getCloseableFile
(String ext) Gets aCloseableFile
backing this blob, which must be closed when done by the caller.getFile()
If this blob is backed by an actual file, returns it.long
Gets the data length in bytes if known.Gets anInputStream
for the data of this blob.void
void
setDigestAlgorithm
(String digestAlgorithm) void
setEncoding
(String encoding) void
setFilename
(String filename) void
setMimeType
(String mimeType) void
transferTo
(File file) void
transferTo
(OutputStream out)
-
Field Details
-
blob
-
filename
-
-
Constructor Details
-
BlobWrapper
-
-
Method Details
-
getFilename
- Specified by:
getFilename
in interfaceBlob
-
setFilename
- Specified by:
setFilename
in interfaceBlob
-
getMimeType
- Specified by:
getMimeType
in interfaceBlob
-
getEncoding
- Specified by:
getEncoding
in interfaceBlob
-
getDigestAlgorithm
- Specified by:
getDigestAlgorithm
in interfaceBlob
-
getDigest
-
setMimeType
- Specified by:
setMimeType
in interfaceBlob
-
setEncoding
- Specified by:
setEncoding
in interfaceBlob
-
setDigestAlgorithm
- Specified by:
setDigestAlgorithm
in interfaceBlob
-
setDigest
-
getStream
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
- Returns:
- the stream
- Throws:
IOException
-
getLength
public long getLength()Description copied from interface:Blob
Gets the data length in bytes if known. -
getByteArray
- Specified by:
getByteArray
in interfaceBlob
- Throws:
IOException
-
getString
- Specified by:
getString
in interfaceBlob
- Throws:
IOException
-
transferTo
- Specified by:
transferTo
in interfaceBlob
- Throws:
IOException
-
transferTo
- Specified by:
transferTo
in interfaceBlob
- Throws:
IOException
-
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.
-
getCloseableFile
Description copied from interface:Blob
Gets aCloseableFile
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.
- Specified by:
getCloseableFile
in interfaceBlob
- Returns:
- a closeable file, to be closed when done
- Throws:
IOException
-
getCloseableFile
Description copied from interface:Blob
Gets aCloseableFile
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.
- Specified by:
getCloseableFile
in interfaceBlob
- Parameters:
ext
- the required extension for the file, ornull
if it doesn't matter- Returns:
- a closeable file, to be closed when done
- Throws:
IOException
-