Class DeflaterInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
java.util.zip.DeflaterInputStream
- All Implemented Interfaces:
- Closeable,- AutoCloseable
Implements an input stream filter for compressing data in the "deflate"
 compression format.
- Since:
- 1.6
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected final byte[]Input buffer for reading compressed data.protected final DeflaterCompressor for this stream.Fields declared in class java.io.FilterInputStreamin
- 
Constructor SummaryConstructorsConstructorDescriptionCreates a new input stream with a default compressor and buffer size.DeflaterInputStream(InputStream in, Deflater defl) Creates a new input stream with the specified compressor and a default buffer size.DeflaterInputStream(InputStream in, Deflater defl, int bufLen) Creates a new input stream with the specified compressor and buffer size.
- 
Method SummaryModifier and TypeMethodDescriptionintReturns 0 after EOF has been reached, otherwise always return 1.voidclose()Closes this input stream and its underlying input stream, discarding any pending uncompressed data.voidmark(int limit) This operation is not supported.booleanintread()Reads a single byte of compressed data from the input stream.intread(byte[] b, int off, int len) Reads compressed data into a byte array.voidreset()This operation is not supported.longskip(long n) Skips over and discards data from the input stream.Methods declared in class java.io.FilterInputStreamreadMethods declared in class java.io.InputStreamnullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
- 
Field Details- 
defCompressor for this stream.
- 
bufprotected final byte[] bufInput buffer for reading compressed data.
 
- 
- 
Constructor Details- 
DeflaterInputStreamCreates a new input stream with a default compressor and buffer size.- Parameters:
- in- input stream to read the uncompressed data to
- Throws:
- NullPointerException- if- inis null
 
- 
DeflaterInputStreamCreates a new input stream with the specified compressor and a default buffer size.- Parameters:
- in- input stream to read the uncompressed data to
- defl- compressor ("deflater") for this stream
- Throws:
- NullPointerException- if- inor- deflis null
 
- 
DeflaterInputStreamCreates a new input stream with the specified compressor and buffer size.- Parameters:
- in- input stream to read the uncompressed data to
- defl- compressor ("deflater") for this stream
- bufLen- compression buffer size
- Throws:
- IllegalArgumentException- if- bufLen <= 0
- NullPointerException- if- inor- deflis null
 
 
- 
- 
Method Details- 
closeCloses this input stream and its underlying input stream, discarding any pending uncompressed data.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Overrides:
- closein class- FilterInputStream
- Throws:
- IOException- if an I/O error occurs
- See Also:
 
- 
readReads a single byte of compressed data from the input stream. This method will block until some input can be read and compressed.- Overrides:
- readin class- FilterInputStream
- Returns:
- a single byte of compressed data, or -1 if the end of the uncompressed input stream is reached
- Throws:
- IOException- if an I/O error occurs or if this stream is already closed
- See Also:
 
- 
readReads compressed data into a byte array. This method will block until some input can be read and compressed.- Overrides:
- readin class- FilterInputStream
- Parameters:
- b- buffer into which the data is read
- off- starting offset of the data within- b
- len- maximum number of compressed bytes to read into- b
- Returns:
- the actual number of bytes read, or -1 if the end of the uncompressed input stream is reached
- Throws:
- NullPointerException- if- bis null
- IndexOutOfBoundsException- if- len > b.length - off
- IOException- if an I/O error occurs or if this input stream is already closed
- See Also:
 
- 
skipSkips over and discards data from the input stream. This method may block until the specified number of bytes are skipped or end of stream is reached.- Overrides:
- skipin class- FilterInputStream
- Implementation Note:
- This method skips at most Integer.MAX_VALUEbytes.
- Parameters:
- n- number of bytes to be skipped. If- nis zero then no bytes are skipped.
- Returns:
- the actual number of bytes skipped, which might be zero
- Throws:
- IOException- if an I/O error occurs or if this stream is already closed
- IllegalArgumentException- if- n < 0
- See Also:
 
- 
availableReturns 0 after EOF has been reached, otherwise always return 1.Programs should not count on this method to return the actual number of bytes that could be read without blocking - Overrides:
- availablein class- FilterInputStream
- Returns:
- zero after the end of the underlying input stream has been reached, otherwise always returns 1
- Throws:
- IOException- if an I/O error occurs or if this stream is already closed
 
- 
markSupportedpublic boolean markSupported()- Overrides:
- markSupportedin class- FilterInputStream
- Returns:
- false, always
- See Also:
 
- 
markpublic void mark(int limit) This operation is not supported.- Overrides:
- markin class- FilterInputStream
- Parameters:
- limit- maximum bytes that can be read before invalidating the position marker
- See Also:
 
- 
resetThis operation is not supported.- Overrides:
- resetin class- FilterInputStream
- Throws:
- IOException- always thrown
- See Also:
 
 
-