com.caucho.quercus.lib.zlib
Class GZInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.caucho.quercus.lib.zlib.GZInputStream
All Implemented Interfaces:
java.io.Closeable

public class GZInputStream
extends java.io.InputStream

Similar to GZIPInputStream but with ability to read appended gzip.


Constructor Summary
GZInputStream(java.io.InputStream in)
           
GZInputStream(java.io.InputStream in, int size)
           
 
Method Summary
 int available()
          Returns 0 if gzip EOF has been reached, 1 otherwise
 void close()
           
 boolean isGzip()
           
 boolean markSupported()
          mark() and reset() are not supported by this class.
 int read()
          Returns the byte read, -1 if EOF
 int read(byte[] b)
          Reads from the compressed stream and stores the resulting uncompressed data into the byte array.
 int read(byte[] b, int off, int len)
          Reads from the compressed stream and stores the resulting uncompressed data into the byte array.
 long skip(long n)
          Skips over and discards n bytes.
 
Methods inherited from class java.io.InputStream
mark, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GZInputStream

public GZInputStream(java.io.InputStream in)
              throws java.io.IOException
Throws:
java.io.IOException

GZInputStream

public GZInputStream(java.io.InputStream in,
                     int size)
              throws java.io.IOException
Throws:
java.io.IOException
Method Detail

available

public int available()
              throws java.io.IOException
Returns 0 if gzip EOF has been reached, 1 otherwise

Overrides:
available in class java.io.InputStream
Throws:
java.io.IOException

close

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

markSupported

public boolean markSupported()
mark() and reset() are not supported by this class.

Overrides:
markSupported in class java.io.InputStream
Returns:
false always

read

public int read()
         throws java.io.IOException
Returns the byte read, -1 if EOF

Specified by:
read in class java.io.InputStream
Returns:
number of bytes read, or -1 if EOF
Throws:
java.io.IOException

read

public int read(byte[] b)
         throws java.io.IOException
Reads from the compressed stream and stores the resulting uncompressed data into the byte array.

Overrides:
read in class java.io.InputStream
Returns:
number of bytes read, or -1 upon EOF
Throws:
java.io.IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Reads from the compressed stream and stores the resulting uncompressed data into the byte array.

Overrides:
read in class java.io.InputStream
Returns:
number of bytes read, or -1 upon EOF
Throws:
java.io.IOException

skip

public long skip(long n)
          throws java.io.IOException
Skips over and discards n bytes.

Overrides:
skip in class java.io.InputStream
Parameters:
n - number of bytes to skip
Returns:
actual number of bytes skipped
Throws:
java.io.IOException

isGzip

public boolean isGzip()