public class OptimizedGZIPOutputStream
extends java.io.OutputStream
GZIPOutputStream
that
reuses underlying Deflater
instance}.Modifier and Type | Field and Description |
---|---|
protected java.util.zip.CRC32 |
_crc |
protected java.util.zip.Deflater |
_deflater |
protected java.util.zip.DeflaterOutputStream |
_deflaterOut |
protected byte[] |
_eightByteBuffer |
protected GZIPRecycler |
_gzipRecycler |
protected java.io.OutputStream |
_rawOut
Underlying output stream that header, compressed content and
footer go to
|
(package private) static byte[] |
DEFAULT_HEADER
For now, static header seems fine, since JDK default gzip writer
does it too:
|
private static int |
GZIP_MAGIC
GZIP header magic number; written out LSB like most everything
else (i.e.
|
Constructor and Description |
---|
OptimizedGZIPOutputStream(java.io.OutputStream out) |
Modifier and Type | Method and Description |
---|---|
private static void |
_putInt(byte[] buf,
int offset,
int value)
Stupid GZIP, writes stuff in wrong order (not network, but x86)
|
private void |
_writeTrailer(java.io.OutputStream out) |
void |
close() |
void |
flush() |
void |
write(byte[] buf) |
void |
write(byte[] buf,
int off,
int len) |
void |
write(int c) |
private static final int GZIP_MAGIC
static final byte[] DEFAULT_HEADER
protected java.util.zip.Deflater _deflater
protected final GZIPRecycler _gzipRecycler
protected final byte[] _eightByteBuffer
protected java.io.OutputStream _rawOut
protected java.util.zip.DeflaterOutputStream _deflaterOut
protected java.util.zip.CRC32 _crc
public OptimizedGZIPOutputStream(java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.OutputStream
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
public final void write(byte[] buf) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public final void write(int c) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] buf, int off, int len) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
private void _writeTrailer(java.io.OutputStream out) throws java.io.IOException
java.io.IOException
private static final void _putInt(byte[] buf, int offset, int value)