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

public class ZipEntryBlob extends AbstractBlob implements Serializable
A Blob backed by an entry in a ZIP file.
Since:
7.2
See Also:
  • Field Details

    • zipFile

      protected final ZipFile zipFile
    • zipEntry

      protected final ZipEntry zipEntry
    • zipBlob

      protected final Blob zipBlob
    • entryName

      protected final String entryName
  • Constructor Details

    • ZipEntryBlob

      public ZipEntryBlob(ZipFile zipFile, ZipEntry zipEntry)
      Creates a Blob from an entry in a zip file. The ZipFile must not be closed until the stream has been read.
      Parameters:
      zipFile - the zip file
      zipEntry - the zip entry
    • ZipEntryBlob

      public ZipEntryBlob(Blob zipBlob, String entryName)
      Creates a Blob from an entry in a ZIP file blob.
      Parameters:
      zipBlob - the ZIP file blob
      entryName - the ZIP entry name
      Since:
      11.5
  • Method Details

    • getStream

      public InputStream getStream() throws IOException
      Description copied from interface: Blob
      Gets an InputStream 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.

      Specified by:
      getStream in interface Blob
      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 interface Blob
      Overrides:
      getLength in class AbstractBlob
      Returns:
      the data length or -1 if not known
    • getFilename

      public String getFilename()
      Specified by:
      getFilename in interface Blob
      Overrides:
      getFilename in class AbstractBlob