Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.jimi.util.zip
Class Inflater

    java.lang.Object
      |
      +--com.sun.jimi.util.zip.Inflater

public class Inflater
extends java.lang.Object

A class to uncompress data stored in the DEFLATE , as described in RFC 1951.

DEFLATE is the compression method used in the popular gzip and (pk)zip utilities. This class will not read zip or gzip files directly, but it provides most of the necessary functions.

This class is a direct translation of the inflate portion of the freely available zlib general purpose compression library, bearing the copyright:

     Copyright (C) 1995-1996 Jean-loup Gailly and Mark Adler

     This software is provided 'as-is', without any express or implied
     warranty.  In no event will the authors be held liable for any damages
     arising from the use of this software.

     Permission is granted to anyone to use this software for any purpose,
     including commercial applications, and to alter it and redistribute it
     freely, subject to the following restrictions:

     1. The origin of this software must not be misrepresented; you must not
        claim that you wrote the original software. If you use this software
        in a product, an acknowledgment in the product documentation would be
        appreciated but is not required.
     2. Altered source versions must be plainly marked as such, and must not be
        misrepresented as being the original software.
     3. This notice may not be removed or altered from any source distribution.

     Jean-loup Gailly        Mark Adler
     gzip@prep.ai.mit.edu    madler@alumni.caltech.edu

Please do not contact either of the above authors regarding the java version of this library.

Field Summary
`byte[]` | `array_in` the array which contains the compressed data
`byte[]` | `array_out` the array which will recieve the uncompressed data
`int` | `avail_in` the number of bytes available in `array_in`
`int` | `avail_out` the number of free bytes in `array_out`
`static byte[]` | `copyright`
`static java.lang.String` | `Copyright`
`java.lang.String` | `msg`
`int` | `next_in` the index of the first byte of compressed data in `array_in`
`int` | `next_out` the index of the first available byte in `array_out`
`int` | `total_in` the total number of bytes that have been read so far
`int` | `total_out` the total number of bytes that have been output so far
`static int` | `Z_BUF_ERROR` Indicates that no progress was made, or there was not enough room in the output buffer when Z_FINISH is used
`static int` | `Z_DATA_ERROR` Indicates that the input data was corrupted
`static int` | `Z_ERRNO`
`static int` | `Z_FINISH` Informs inflate() that this is the last of the data.
`static int` | `Z_FULL_FLUSH`
`static int` | `Z_NEED_DICT` Indicates that a preset dictionary is needed before decompression continues
`static int` | `Z_NO_FLUSH`
`static int` | `Z_OK` Indicates that no errors were encountered
`static int` | `Z_PARTIAL_FLUSH` Specifies that the Inflater should flush as much of the output as possible to the output buffer
`static int` | `Z_STREAM_END` Indicates that the end of the stream has been reached, and all uncompressed data has been flushed
`static int` | `Z_STREAM_ERROR` Indicates that the stream was inconsistent (for example, if array_in or array_out were null)
`static int` | `Z_SYNC_FLUSH`

Constructor Summary
`Inflater()` Constructs a new Inflater object.
`Inflater(boolean nowrap)` Constructs an inflater object.

Method Summary
`void` | `enableAdler(boolean check)` Enables or disables the computation of the Adler32 CRC.
`boolean` | `finished()` Returns true if the end of the data stream has been reached
`int` | `getAdler()` Returns the current Adler32 Checksum of the stream
`int` | `getRemaining()` Tells how many bytes are remaining in the input array
`int` | `getTotalIn()` Returns the number of bytes processed by the Inflater object so far
`int` | `getTotalOut()` Returns the number of uncompressed data generated by the Inflater object so far
`long` | `inflate_blocks_reset(long c)`
`int` | `inflate_blocks(int r)`
`int` | `inflate_codes(int r)`
`int` | `inflate_fast(int bl, int bd, com.sun.jimi.util.zip.huft tl, com.sun.jimi.util.zip.huft td)`
`protected int` | `inflate_flush(int r)`
`int` | `inflate_unlocked(int f)`
`int` | `inflate(byte[] buf, int off, int len)` Inflates the compressed data to the specified output location.
`static void` | `main(java.lang.String[] args)`
`boolean` | `needsDictionary()` Tells whether or not a preset dictionary is needed (only for ZLIB streams) Currently not implemented.
`boolean` | `needsInput()` Tells whether or not more input is needed
`void` | `reset()` Reset the internal state of the object so that it can be used for another decompression run
`void` | `setInput(byte[] buf, int off, int len)` Tells the Inflater where to take input from

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### array_in

    public byte[] array_in

  the array which contains the compressed data

### next_in

    public int next_in

  the index of the first byte of compressed data in `array_in`

### avail_in

    public int avail_in

  the number of bytes available in `array_in`

### total_in

    public int total_in

  the total number of bytes that have been read so far

### array_out

    public byte[] array_out

  the array which will recieve the uncompressed data

### next_out

    public int next_out

  the index of the first available byte in `array_out`

### avail_out

    public int avail_out

  the number of free bytes in `array_out`

### total_out

    public int total_out

  the total number of bytes that have been output so far

### Z_NO_FLUSH

    public static final int Z_NO_FLUSH

### Z_PARTIAL_FLUSH

    public static final int Z_PARTIAL_FLUSH

  Specifies that the Inflater should flush as much of the output as possible to the output buffer

### Z_SYNC_FLUSH

    public static final int Z_SYNC_FLUSH

### Z_FULL_FLUSH

    public static final int Z_FULL_FLUSH

### Z_FINISH

    public static final int Z_FINISH

  Informs inflate() that this is the last of the data.

### Z_OK

    public static final int Z_OK

  Indicates that no errors were encountered

### Z_STREAM_END

    public static final int Z_STREAM_END

  Indicates that the end of the stream has been reached, and all uncompressed data has been flushed

### Z_NEED_DICT

    public static final int Z_NEED_DICT

  Indicates that a preset dictionary is needed before decompression continues

### Z_ERRNO

    public static final int Z_ERRNO

### Z_STREAM_ERROR

    public static final int Z_STREAM_ERROR

  Indicates that the stream was inconsistent (for example, if array_in or array_out were null)

### Z_DATA_ERROR

    public static final int Z_DATA_ERROR

  Indicates that the input data was corrupted

### Z_BUF_ERROR

    public static final int Z_BUF_ERROR

  Indicates that no progress was made, or there was not enough room in the output buffer when Z_FINISH is used

### Copyright

    public static final java.lang.String Copyright

### copyright

    public static final byte[] copyright

### msg

    public java.lang.String msg

Constructor Detail

### Inflater

    public Inflater(boolean nowrap)

  Constructs an inflater object.
  Parameters:
    `nowrap` - Does not wrap the DEFLATE stream with the ZLIB information

### Inflater

    public Inflater()

  Constructs a new Inflater object. Same as Inflater(false)

Method Detail

### reset

    public void reset()

  Reset the internal state of the object so that it can be used for another decompression run

### setInput

    public void setInput(byte[] buf,
                         int off,
                         int len)

  Tells the Inflater where to take input from
  Parameters:
    `buf` - the array containing the compressed data
    `off` - the index of the first byte in the array
    `len` - the number of bytes of data in the array

### getRemaining

    public int getRemaining()

  Tells how many bytes are remaining in the input array

### needsInput

    public boolean needsInput()

  Tells whether or not more input is needed

### needsDictionary

    public boolean needsDictionary()

  Tells whether or not a preset dictionary is needed (only for ZLIB streams) Currently not implemented.

### inflate_blocks_reset

    public final long inflate_blocks_reset(long c)

### inflate

    public int inflate(byte[] buf,
                       int off,
                       int len)
                throws DataFormatException

  Inflates the compressed data to the specified output location.
  Parameters:
    `buf` - the array in which to store the data
    `off` - the index of the first available output location
    `len` - how many bytes are available there

### getAdler

    public int getAdler()

  Returns the current Adler32 Checksum of the stream

### getTotalIn

    public int getTotalIn()

  Returns the number of bytes processed by the Inflater object so far

### getTotalOut

    public int getTotalOut()

  Returns the number of uncompressed data generated by the Inflater object so far

### finished

    public boolean finished()

  Returns true if the end of the data stream has been reached

### enableAdler

    public void enableAdler(boolean check)

  Enables or disables the computation of the Adler32 CRC. Disabling the Adler32 speeds things up, but doesn't provide the data integrity check.
  Parameters:
    `check` - if true, enables Adler32 checking

### inflate_unlocked

    public final int inflate_unlocked(int f)

### inflate_flush

    protected int inflate_flush(int r)

### inflate_codes

    public final int inflate_codes(int r)

### inflate_fast

    public final int inflate_fast(int bl,
                                  int bd,
                                  com.sun.jimi.util.zip.huft tl,
                                  com.sun.jimi.util.zip.huft td)

### inflate_blocks

    public final int inflate_blocks(int r)

### main

    public static void main(java.lang.String[] args)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD