Package loci.common

Class ZipHandle

All Implemented Interfaces:
DataInput, DataOutput, IRandomAccess

public class ZipHandle extends StreamHandle
StreamHandle implementation for reading from Zip-compressed files or byte arrays. Instances of ZipHandle are read-only.
Author:
Melissa Linkert melissa at glencoesoftware.com
See Also:
  • Constructor Details

  • Method Details

    • isZipFile

      public static boolean isZipFile(String file) throws IOException
      Parameters:
      file - a name that can be passed to Location.getHandle(String, boolean, boolean)
      Returns:
      true if the given filename is a Zip file.
      Throws:
      IOException - if the file cannot be read
    • getEntryName

      public String getEntryName()
      Returns:
      the name of the backing Zip entry.
    • getInputStream

      public DataInputStream getInputStream()
      Returns:
      the DataInputStream corresponding to the backing Zip entry.
    • getEntryCount

      public int getEntryCount()
      Returns:
      the number of entries.
    • close

      public void close() throws IOException
      Description copied from interface: IRandomAccess
      Closes this random access stream and releases any system resources associated with the stream.
      Specified by:
      close in interface IRandomAccess
      Overrides:
      close in class StreamHandle
      Throws:
      IOException - if the underlying stream(s) could not be closed
    • resetStream

      protected void resetStream() throws IOException
      Description copied from class: StreamHandle
      Close and reopen the stream; the stream pointer and mark should be reset to 0. This method is called if we need to seek backwards within the stream.
      Specified by:
      resetStream in class StreamHandle
      Throws:
      IOException - if the stream cannot be reset