- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- java.util.zip.DeflaterInputStream
-
- All Implemented Interfaces:
- Closeable, AutoCloseable
public class DeflaterInputStream extends FilterInputStream
Implements an input stream filter for compressing data in the "deflate" compression format.- Since:
- 1.6
- See Also:
DeflaterOutputStream,InflaterOutputStream,InflaterInputStream
-
-
Field Summary
Fields Modifier and Type Field and Description protected byte[]bufInput buffer for reading compressed data.protected DeflaterdefCompressor for this stream.-
Fields inherited from class java.io.FilterInputStream
in
-
-
Constructor Summary
Constructors Constructor and Description DeflaterInputStream(InputStream in)Creates 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 Summary
Methods Modifier and Type Method and Description intavailable()Returns 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.booleanmarkSupported()intread()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 inherited from class java.io.FilterInputStream
read
-
-
-
-
Field Detail
-
def
protected final Deflater def
Compressor for this stream.
-
buf
protected final byte[] buf
Input buffer for reading compressed data.
-
-
Constructor Detail
-
DeflaterInputStream
public DeflaterInputStream(InputStream in)
Creates a new input stream with a default compressor and buffer size.- Parameters:
in- input stream to read the uncompressed data to- Throws:
NullPointerException- ifinis null
-
DeflaterInputStream
public DeflaterInputStream(InputStream in, Deflater defl)
Creates a new input stream with the specified compressor and a default buffer size.- Parameters:
in- input stream to read the uncompressed data todefl- compressor ("deflater") for this stream- Throws:
NullPointerException- ifinordeflis null
-
DeflaterInputStream
public DeflaterInputStream(InputStream in, Deflater defl, int bufLen)
Creates a new input stream with the specified compressor and buffer size.- Parameters:
in- input stream to read the uncompressed data todefl- compressor ("deflater") for this streambufLen- compression buffer size- Throws:
IllegalArgumentException- ifbufLenis <= 0NullPointerException- ifinordeflis null
-
-
Method Detail
-
close
public void close() throws IOExceptionCloses this input stream and its underlying input stream, discarding any pending uncompressed data.- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceAutoCloseable- Overrides:
closein classFilterInputStream- Throws:
IOException- if an I/O error occurs- See Also:
FilterInputStream.in
-
read
public int read() throws IOExceptionReads a single byte of compressed data from the input stream. This method will block until some input can be read and compressed.- Overrides:
readin classFilterInputStream- 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:
FilterInputStream.in
-
read
public int read(byte[] b, int off, int len) throws IOExceptionReads compressed data into a byte array. This method will block until some input can be read and compressed.- Overrides:
readin classFilterInputStream- Parameters:
b- buffer into which the data is readoff- starting offset of the data withinblen- maximum number of compressed bytes to read intob- Returns:
- the actual number of bytes read, or -1 if the end of the uncompressed input stream is reached
- Throws:
IndexOutOfBoundsException- iflen>b.length - offIOException- if an I/O error occurs or if this input stream is already closed- See Also:
FilterInputStream.in
-
skip
public long skip(long n) throws IOExceptionSkips over and discards data from the input stream. This method may block until the specified number of bytes are read and skipped. Note: Whilenis given as along, the maximum number of bytes which can be skipped isInteger.MAX_VALUE.- Overrides:
skipin classFilterInputStream- Parameters:
n- number of bytes to be skipped- Returns:
- the actual number of bytes skipped
- Throws:
IOException- if an I/O error occurs or if this stream is already closed
-
available
public int available() throws IOExceptionReturns 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 classFilterInputStream- 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
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classFilterInputStream- Returns:
- false, always
- See Also:
FilterInputStream.in,InputStream.mark(int),InputStream.reset()
-
mark
public void mark(int limit)
This operation is not supported.- Overrides:
markin classFilterInputStream- Parameters:
limit- maximum bytes that can be read before invalidating the position marker- See Also:
FilterInputStream.in,FilterInputStream.reset()
-
reset
public void reset() throws IOExceptionThis operation is not supported.- Overrides:
resetin classFilterInputStream- Throws:
IOException- always thrown- See Also:
FilterInputStream.in,FilterInputStream.mark(int)
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-java/util/zip/DeflaterInputStream.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur van deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.