public abstract class CompressorStream extends OutputStream
Modifier and Type | Field and Description |
---|---|
protected int |
block |
int |
blockLen |
protected long |
bytesIn |
protected long |
bytesOut |
protected boolean |
done |
protected IDatChunkWriter |
idatChunkWriter |
protected boolean |
storeFirstByte |
long |
totalbytes |
Constructor and Description |
---|
CompressorStream(IDatChunkWriter idatCw,
int blockLen,
long totalbytes) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Releases resources.
|
abstract void |
done()
Will be called automatically when the number of bytes reaches the total expected Can be also be called from
outside.
|
long |
getBytesCompressed()
compressed (out) bytes.
|
long |
getBytesRaw()
raw (input) bytes.
|
double |
getCompressionRatio()
compressed/raw.
|
byte[] |
getFirstBytes() |
boolean |
isClosed() |
boolean |
isDone() |
abstract void |
mywrite(byte[] data,
int off,
int len)
same as write, but guarantedd to not exceed blockLen The implementation should update bytesOut and bytesInt but not
check for totalBytes
|
void |
reset() |
void |
setStoreFirstByte(boolean storeFirstByte,
int nblocks) |
void |
write(byte[] data) |
void |
write(byte[] data,
int off,
int len) |
void |
write(int i) |
flush
protected IDatChunkWriter idatChunkWriter
public final int blockLen
public final long totalbytes
protected boolean done
protected long bytesIn
protected long bytesOut
protected int block
protected boolean storeFirstByte
public CompressorStream(IDatChunkWriter idatCw, int blockLen, long totalbytes)
idatCw
- Can be null (if we are only interested in compute compression ratio)blockLen
- Estimated maximum block length. If unknown, use -1.totalbytes
- Expected total bytes to be fed. If unknown, use -1.public void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
public abstract void done()
public final void write(byte[] data)
write
in class OutputStream
public final void write(byte[] data, int off, int len)
write
in class OutputStream
public abstract void mywrite(byte[] data, int off, int len)
public final double getCompressionRatio()
public final long getBytesRaw()
public final long getBytesCompressed()
public boolean isClosed()
public boolean isDone()
public byte[] getFirstBytes()
public void setStoreFirstByte(boolean storeFirstByte, int nblocks)
public void reset()
public void write(int i)
write
in class OutputStream
Copyright © 2014. All rights reserved.