Package com.ning.compress.gzip
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 CRC32
protected Deflater
protected DeflaterOutputStream
protected final byte[]
protected final GZIPRecycler
protected OutputStream
Underlying 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 int
GZIP 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 void
void
close()
void
flush()
final void
write
(byte[] buf) void
write
(byte[] buf, int off, int len) final void
write
(int c) Methods inherited from class java.io.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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in 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)
-