Class OptimizedGZIPOutputStream
java.lang.Object
java.io.OutputStream
com.ning.compress.gzip.OptimizedGZIPOutputStream
- All Implemented Interfaces:
Closeable, Flushable, AutoCloseable
Optimized variant of
GZIPOutputStream that
reuses underlying Deflater instance}.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CRC32protected Deflaterprotected DeflaterOutputStreamprotected final byte[]protected final GZIPRecyclerprotected OutputStreamUnderlying output stream that header, compressed content and footer go to(package private) static final byte[]For now, static header seems fine, since JDK default gzip writer does it too:private static final intGZIP header magic number; written out LSB like most everything else (i.e. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static final void_putInt(byte[] buf, int offset, int value) Stupid GZIP, writes stuff in wrong order (not network, but x86)private voidvoidclose()voidflush()final voidwrite(byte[] buf) voidwrite(byte[] buf, int off, int len) final voidwrite(int c) Methods inherited from class OutputStream
nullOutputStream
-
Field Details
-
GZIP_MAGIC
private static final int GZIP_MAGICGZIP header magic number; written out LSB like most everything else (i.e. as 0x1f 0x8b)- See Also:
-
DEFAULT_HEADER
static final byte[] DEFAULT_HEADERFor now, static header seems fine, since JDK default gzip writer does it too: -
_deflater
-
_gzipRecycler
-
_eightByteBuffer
protected final byte[] _eightByteBuffer -
_rawOut
Underlying output stream that header, compressed content and footer go to -
_deflaterOut
-
_crc
-
-
Constructor Details
-
OptimizedGZIPOutputStream
- Throws:
IOException
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
_writeTrailer
- Throws:
IOException
-
_putInt
private static final void _putInt(byte[] buf, int offset, int value) Stupid GZIP, writes stuff in wrong order (not network, but x86)
-