Package org.eclipse.mat.hprof

# Class GZIPInputStream2

java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.eclipse.mat.hprof.GZIPInputStream2

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`

public class GZIPInputStream2 extends 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.

## Constructor Summary

Constructors
Constructor
Description
`GZIPInputStream2(InputStream is)`
Normal constructor
`GZIPInputStream2(GZIPInputStream2 gs)`
Copy constructor used for duplicating a stream.

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
`String`
`comment()`
`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.
`String`
`toString()`

### Methods inherited from class java.io.FilterInputStream

`available, read`

### Methods inherited from class java.io.InputStream

`nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### GZIPInputStream2

public GZIPInputStream2(GZIPInputStream2 gs) throws 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:
  `IOException`

### GZIPInputStream2

public GZIPInputStream2(InputStream is) throws IOException
Normal constructor

Parameters:
  `is` - the compressed data
Throws:
  `IOException`

## Method Details

### read

public int read() throws IOException

Overrides:
  `read` in class `FilterInputStream`
Throws:
  `IOException`

### read

public int read(byte[] buf, int off, int len) throws IOException

Overrides:
  `read` in class `FilterInputStream`
Throws:
  `IOException`

### skip

public long skip(long n) throws 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 `FilterInputStream`
Parameters:
  `n` - bytes to skip
Returns:
  bytes actually skipped
Throws:
  `IOException`

### comment

public String comment()

### filename

public String filename()

### mark

public void mark(int limit)

Overrides:
  `mark` in class `FilterInputStream`

### reset

public void reset() throws IOException

Overrides:
  `reset` in class `FilterInputStream`
Throws:
  `IOException`

### markSupported

public boolean markSupported()

Overrides:
  `markSupported` in class `FilterInputStream`

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### close

public void close() throws IOException

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Closeable`
Overrides:
  `close` in class `FilterInputStream`
Throws:
  `IOException`