SnappyFramedOutputStream
which implements
the standard x-snappy-framed
specification.@Deprecated public class SnappyOutputStream extends OutputStream
((crc >>> 15) | (crc << 17)) + 0xa282ead8
An uncompressed block is simply copied from the input, thus guaranteeing
that the output is never larger than the input (not including the header).
NOTE:This data produced by this class is not compatible with the
x-snappy-framed
specification. It can only be read by
SnappyInputStream
.
Modifier and Type | Field and Description |
---|---|
static double |
MIN_COMPRESSION_RATIO
Deprecated.
Write out the uncompressed content if the compression ratio (compressed length / raw length) exceeds this value.
|
Constructor and Description |
---|
SnappyOutputStream(OutputStream out)
Deprecated.
Creates a Snappy output stream to write data to the specified underlying output stream.
|
Modifier and Type | Method and Description |
---|---|
protected int |
calculateCRC32C(byte[] data,
int offset,
int length)
Deprecated.
Calculates a CRC32C checksum over the data.
|
void |
close() |
void |
flush() |
static SnappyOutputStream |
newChecksumFreeBenchmarkOutputStream(OutputStream out)
Deprecated.
Creates a Snappy output stream with block checksums disabled.
|
void |
write(byte[] input,
int offset,
int length) |
void |
write(int b) |
protected void |
writeBlock(OutputStream out,
byte[] data,
int offset,
int length,
boolean compressed,
int crc32c)
Deprecated.
Write a frame (block) to out.
|
protected void |
writeHeader(OutputStream out)
Deprecated.
Writes the implementation specific header or "marker bytes" to
out.
|
write
public static final double MIN_COMPRESSION_RATIO
public SnappyOutputStream(OutputStream out) throws IOException
out
- the underlying output streamIOException
public static SnappyOutputStream newChecksumFreeBenchmarkOutputStream(OutputStream out) throws IOException
out
- the underlying output streamIOException
protected void writeHeader(OutputStream out) throws IOException
out
- The underlying OutputStream
.IOException
protected int calculateCRC32C(byte[] data, int offset, int length)
This can be overridden to provider alternative implementations (such as returning 0 if checksums are not desired).
protected void writeBlock(OutputStream out, byte[] data, int offset, int length, boolean compressed, int crc32c) throws IOException
out
- The OutputStream
to write to.data
- The data to write.offset
- The offset in data to start at.length
- The length of data to use.compressed
- Indicates if data is the compressed or raw content.
This is based on whether the compression ratio desired is
reached.crc32c
- The calculated checksum.IOException
public void write(int b) throws IOException
write
in class OutputStream
IOException
public void write(byte[] input, int offset, int length) throws IOException
write
in class OutputStream
IOException
public final void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
public final void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
Copyright © 2011–2020. All rights reserved.