public class CompressionOutputStream extends OutputStream
Modifier and Type | Field and Description |
---|---|
private byte[] |
buffer |
private int |
bufferIndex |
private byte[] |
compressed |
private boolean |
dataWritten |
static int |
DEFAULT_BUFFER_SIZE |
static int |
DEFAULT_COMPRESSION_LEVEL |
private Deflater |
deflater |
static int |
MIN_BUFFER_SIZE |
private OutputStream |
out |
static byte[] |
SYNC_BYTES |
Constructor and Description |
---|
CompressionOutputStream(OutputStream outStream) |
CompressionOutputStream(OutputStream outStream,
int bufferSize) |
CompressionOutputStream(OutputStream outStream,
int bufferSize,
int level,
int strategy) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
bufferFull() |
void |
close() |
protected void |
compressAndWrite()
Compresses the currently buffered chunk of data and sends it to the output stream
|
void |
flush() |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
private void |
writeChunkHeader(int compressedBytes) |
private void |
writeInt(OutputStream out,
int val) |
public static final byte[] SYNC_BYTES
public static final int DEFAULT_COMPRESSION_LEVEL
public static final int DEFAULT_BUFFER_SIZE
public static final int MIN_BUFFER_SIZE
private final OutputStream out
private final Deflater deflater
private final byte[] buffer
private final byte[] compressed
private int bufferIndex
private boolean dataWritten
public CompressionOutputStream(OutputStream outStream)
public CompressionOutputStream(OutputStream outStream, int bufferSize)
public CompressionOutputStream(OutputStream outStream, int bufferSize, int level, int strategy)
protected void compressAndWrite() throws IOException
IOException
- if issues occur writing to streamprivate void writeChunkHeader(int compressedBytes) throws IOException
IOException
private void writeInt(OutputStream out, int val) throws IOException
IOException
protected boolean bufferFull()
public void write(int b) throws IOException
write
in class OutputStream
IOException
public void write(byte[] b) throws IOException
write
in class OutputStream
IOException
public void write(byte[] b, int off, int len) throws IOException
write
in class OutputStream
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
Copyright © 2016 Apache NiFi Project. All rights reserved.