Package org.nuxeo.ecm.core.api.impl.blob
Class ZipEntryBlob
java.lang.Object
org.nuxeo.ecm.core.api.impl.blob.AbstractBlob
org.nuxeo.ecm.core.api.impl.blob.ZipEntryBlob
- All Implemented Interfaces:
Serializable
,Blob
A
Blob
backed by an entry in a ZIP file.- Since:
- 7.2
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
InputStream
for a ZIP entry, that closes all necessary resources when closed. -
Field Summary
Modifier and TypeFieldDescriptionprotected final String
protected final Blob
protected final ZipEntry
protected final ZipFile
Fields inherited from class org.nuxeo.ecm.core.api.impl.blob.AbstractBlob
digest, digestAlgorithm, encoding, filename, mimeType, TEXT_PLAIN, UTF_8
-
Constructor Summary
ConstructorDescriptionZipEntryBlob
(ZipFile zipFile, ZipEntry zipEntry) Creates aBlob
from an entry in a zip file.ZipEntryBlob
(Blob zipBlob, String entryName) Creates aBlob
from an entry in a ZIP file blob. -
Method Summary
Modifier and TypeMethodDescriptionlong
Gets the data length in bytes if known.Gets anInputStream
for the data of this blob.Methods inherited from class org.nuxeo.ecm.core.api.impl.blob.AbstractBlob
equals, equalsStream, getByteArray, getCloseableFile, getCloseableFile, getDigest, getDigestAlgorithm, getEncoding, getFile, getMimeType, getString, hashCode, setDigest, setDigestAlgorithm, setEncoding, setFilename, setMimeType, transferTo, transferTo
-
Field Details
-
zipFile
-
zipEntry
-
zipBlob
-
entryName
-
-
Constructor Details
-
ZipEntryBlob
Creates aBlob
from an entry in a zip file. TheZipFile
must not be closed until the stream has been read.- Parameters:
zipFile
- the zip filezipEntry
- the zip entry
-
ZipEntryBlob
Creates aBlob
from an entry in a ZIP file blob.- Parameters:
zipBlob
- the ZIP file blobentryName
- the ZIP entry name- Since:
- 11.5
-
-
Method Details
-
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.- Specified by:
getLength
in interfaceBlob
- Overrides:
getLength
in classAbstractBlob
- Returns:
- the data length or -1 if not known
-
getFilename
- Specified by:
getFilename
in interfaceBlob
- Overrides:
getFilename
in classAbstractBlob
-