Class GZIPInputStream2

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class GZIPInputStream2
    extends java.io.FilterInputStream
    A stream for reading Gzip compressed files. Uses a modified InflaterInputStream to allow the state of the stream to be duplicated, aiding code for random access to Gzip files.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      java.lang.String comment()  
      java.lang.String filename()  
      void mark​(int limit)  
      boolean markSupported()  
      int read()  
      int read​(byte[] buf, int off, int len)  
      void reset()  
      long skip​(long n)
      Need to implement FilterInputStream.skip(long) to the check CRC.
      java.lang.String toString()  
      • Methods inherited from class java.io.FilterInputStream

        available, read
      • Methods inherited from class java.io.InputStream

        nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • GZIPInputStream2

        public GZIPInputStream2​(GZIPInputStream2 gs)
                         throws java.io.IOException
        Copy constructor used for duplicating a stream. To use either stream thereafter the underlying stream must be in the correct position.
        Parameters:
        gs - the stream to be duplicated
        Throws:
        java.io.IOException
      • GZIPInputStream2

        public GZIPInputStream2​(java.io.InputStream is)
                         throws java.io.IOException
        Normal constructor
        Parameters:
        is - the compressed data
        Throws:
        java.io.IOException
    • Method Detail

      • read

        public int read()
                 throws java.io.IOException
        Overrides:
        read in class java.io.FilterInputStream
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] buf,
                        int off,
                        int len)
                 throws java.io.IOException
        Overrides:
        read in class java.io.FilterInputStream
        Throws:
        java.io.IOException
      • skip

        public long skip​(long n)
                  throws java.io.IOException
        Need to implement FilterInputStream.skip(long) to the check CRC. We can call the underlying skip(long) if we are rereading data.
        Overrides:
        skip in class java.io.FilterInputStream
        Parameters:
        n - bytes to skip
        Returns:
        bytes actually skipped
        Throws:
        java.io.IOException
      • comment

        public java.lang.String comment()
      • filename

        public java.lang.String filename()
      • mark

        public void mark​(int limit)
        Overrides:
        mark in class java.io.FilterInputStream
      • reset

        public void reset()
                   throws java.io.IOException
        Overrides:
        reset in class java.io.FilterInputStream
        Throws:
        java.io.IOException
      • markSupported

        public boolean markSupported()
        Overrides:
        markSupported in class java.io.FilterInputStream
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.FilterInputStream
        Throws:
        java.io.IOException