public abstract class CompressorStream extends FilterOutputStream
| Modifier and Type | Field and Description |
|---|---|
protected int |
block |
int |
blockLen |
protected long |
bytesIn |
protected long |
bytesOut |
protected boolean |
done |
protected OutputStream |
os |
protected boolean |
storeFirstByte |
long |
totalbytes |
out| Constructor and Description |
|---|
CompressorStream(OutputStream os,
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.
|
void |
flush() |
long |
getBytesCompressed()
compressed (out) bytes.
|
long |
getBytesRaw()
raw (input) bytes.
|
double |
getCompressionRatio()
compressed/raw.
|
byte[] |
getFirstBytes() |
OutputStream |
getOs() |
boolean |
isClosed() |
boolean |
isDone() |
protected abstract void |
mywrite(byte[] b,
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 |
reset(OutputStream os)
resets and sets a new outputstream
|
void |
setStoreFirstByte(boolean storeFirstByte,
int nblocks) |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
protected OutputStream os
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(OutputStream os, int blockLen, long totalbytes)
os - 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 Closeableclose in interface AutoCloseableclose in class FilterOutputStreampublic abstract void done()
public final void write(byte[] b,
int off,
int len)
write in class FilterOutputStreamprotected abstract void mywrite(byte[] b,
int off,
int len)
public final void write(byte[] b)
write in class FilterOutputStreampublic void write(int b)
throws IOException
write in class FilterOutputStreamIOExceptionpublic void reset()
public void reset(OutputStream os)
os - public final double getCompressionRatio()
public final long getBytesRaw()
public final long getBytesCompressed()
public OutputStream getOs()
public void flush()
flush in interface Flushableflush in class FilterOutputStreampublic boolean isClosed()
public boolean isDone()
public byte[] getFirstBytes()
public void setStoreFirstByte(boolean storeFirstByte,
int nblocks)
Copyright © 2014. All rights reserved.