GZIPOutputStream
open class GZIPOutputStream : DeflaterOutputStream
This class implements a stream filter for writing compressed data in the GZIP file format.
Summary
Public constructors |
Creates a new output stream with a default buffer size.
|
Creates a new output stream with a default buffer size and the specified flush mode.
|
Creates a new output stream with the specified buffer size.
|
Creates a new output stream with the specified buffer size and flush mode.
|
Public methods |
open Unit |
Finishes writing compressed data to the output stream without closing the underlying stream.
|
open Unit |
Writes array of bytes to the compressed output stream.
|
Inherited functions |
From class DeflaterOutputStream
Unit |
close()
Writes remaining compressed data to the output stream and closes the underlying stream.
|
Unit |
deflate()
Writes next block of compressed data to the output stream.
|
Unit |
flush()
Flushes the compressed output stream. If syncFlush is true when this compressed output stream is constructed, this method first flushes the underlying compressor with the flush mode Deflater.SYNC_FLUSH to force all pending data to be flushed out to the output stream and then flushes the output stream. Otherwise this method only flushes the output stream without flushing the compressor .
|
Unit |
write(b: Int)
Writes a byte to the compressed output stream. This method will block until the byte can be written.
|
|
From class OutputStream
OutputStream! |
nullOutputStream()
Returns a new OutputStream which discards all bytes. The returned stream is initially open. The stream is closed by calling the close() method. Subsequent calls to close() have no effect.
While the stream is open, the write(int) , write(byte[]) , and write(byte[], int, int) methods do nothing. After the stream has been closed, these methods all throw IOException .
The flush() method does nothing.
|
|
From class FilterOutputStream
Unit |
write(b: ByteArray!)
Writes b.length bytes to this output stream.
The write method of FilterOutputStream calls its write method of three arguments with the arguments b , 0 , and b.length .
Note that this method does not call the one-argument write method of its underlying output stream with the single argument b .
|
|
Properties |
CRC32! |
CRC-32 of uncompressed data.
|
Public constructors
GZIPOutputStream
GZIPOutputStream(out: OutputStream!)
Creates a new output stream with a default buffer size.
The new output stream instance is created as if by invoking the 2-argument constructor GZIPOutputStream(out, false).
Exceptions |
java.io.IOException |
If an I/O error has occurred. |
GZIPOutputStream
GZIPOutputStream(
out: OutputStream!,
syncFlush: Boolean)
Creates a new output stream with a default buffer size and the specified flush mode.
Parameters |
out |
OutputStream!: the output stream |
syncFlush |
Boolean: if true invocation of the inherited java.util.zip.DeflaterOutputStream#flush() method of this instance flushes the compressor with flush mode Deflater.SYNC_FLUSH before flushing the output stream, otherwise only flushes the output stream |
Exceptions |
java.io.IOException |
If an I/O error has occurred. |
GZIPOutputStream
GZIPOutputStream(
out: OutputStream!,
size: Int)
Creates a new output stream with the specified buffer size.
The new output stream instance is created as if by invoking the 3-argument constructor GZIPOutputStream(out, size, false). Android-note: Android limits the number of UnbufferedIO operations that can be performed, so consider using buffered inputs with this class. More information can be found in the UnbufferedIO and StrictMode documentation.
Parameters |
out |
OutputStream!: the output stream |
size |
Int: the output buffer size |
Exceptions |
java.io.IOException |
If an I/O error has occurred. |
java.lang.IllegalArgumentException |
if size <= 0 |
GZIPOutputStream
GZIPOutputStream(
out: OutputStream!,
size: Int,
syncFlush: Boolean)
Creates a new output stream with the specified buffer size and flush mode.
Parameters |
out |
OutputStream!: the output stream |
size |
Int: the output buffer size |
syncFlush |
Boolean: if true invocation of the inherited java.util.zip.DeflaterOutputStream#flush() method of this instance flushes the compressor with flush mode Deflater.SYNC_FLUSH before flushing the output stream, otherwise only flushes the output stream |
Exceptions |
java.io.IOException |
If an I/O error has occurred. |
java.lang.IllegalArgumentException |
if size <= 0 |
Public methods
finish
open fun finish(): Unit
Finishes writing compressed data to the output stream without closing the underlying stream. Use this method when applying multiple filters in succession to the same output stream.
Exceptions |
java.io.IOException |
if an I/O error has occurred |
write
open fun write(
buf: ByteArray!,
off: Int,
len: Int
): Unit
Writes array of bytes to the compressed output stream. This method will block until all the bytes are written.
Parameters |
b |
the data to be written |
off |
Int: the start offset of the data |
len |
Int: the length of the data |
buf |
ByteArray!: the data to be written |
Exceptions |
java.io.IOException |
If an I/O error has occurred. |
Properties
crc
protected var crc: CRC32!
CRC-32 of uncompressed data.