|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.jagrlib.DefaultProperty
cz.cuni.jagrlib.Piece
cz.cuni.jagrlib.piece.ZLIBCodec
public class ZLIBCodec
ZLIB codec. Uses built-in Java ZLIB port from java.util.zip
package.
Nested Class Summary | |
---|---|
protected class |
ZLIBCodec.InStream
InputStream proxy (for InflaterInputStream ). |
protected class |
ZLIBCodec.OutStream
OutputStream proxy (for DeflaterOutputStream ). |
Field Summary | |
---|---|
protected int |
actualCtx
Id of the actual context. |
protected static java.lang.String |
CATEGORY
Object category. |
static java.lang.String |
COMPRESSION_LEVEL
|
static java.lang.String |
COMPRESSION_STRATEGY
|
protected java.util.zip.InflaterInputStream |
iCtx
The actual context (decoder). |
protected ZLIBCodec.InStream |
iStream
Actual input stream (for InflaterInputStream link). |
protected int |
level
Compression level. |
protected java.util.zip.DeflaterOutputStream |
oCtx
The actual context (coder). |
protected ZLIBCodec.OutStream |
oStream
Actual output stream (for DeflaterOutputStream link). |
protected boolean |
output
Opened for output (encoding)? |
protected long |
position
Actual position in original (logical) stream. |
protected long |
rawBits
Actual position in compressed (binary) stream. |
static RegPiece |
reg
Static registration instance for this class. |
protected int |
strategy
Deflater compression strategy. |
protected BitStream |
stream
Associated I/O stream. |
protected static java.lang.String |
TEMPLATE_NAME
Object template identifier. |
Fields inherited from class cz.cuni.jagrlib.Piece |
---|
channels, info, pl, plugs, TEMPLATE_TYPE, userBreak |
Fields inherited from interface cz.cuni.jagrlib.iface.Property |
---|
LOGGING, STATISTICS, TEXT_DESCRIPTION |
Constructor Summary | |
---|---|
ZLIBCodec()
|
Method Summary | |
---|---|
boolean |
available()
Are they any input symbols (bits) available? |
void |
close()
Close the stream.. |
long |
compressed()
Actual codec compressed position in bits (total amount in all contexts). |
void |
flush()
Codec flush. |
int |
get()
Get next character from compressed stream. |
java.lang.Object |
get(java.lang.String key)
Gets the given property. |
int |
get(WheelOfFortune wheel)
Decodes one subinterval from the given WheelOfFortune . |
long |
getBits(int length)
Reads the given amount of "raw" bits (by-passes the entropy decoder). |
int |
getMaxSymbol()
Retrieves maximal symbol value for the actual context. |
void |
open(boolean output,
int ctx)
Codec initialization. |
long |
position()
Actual codec external position in symbols (total amount in all contexts). |
void |
put(int symbol)
Puts the given symbol into the stream. |
void |
put(WheelOfFortune wheel,
int s)
Encodes one subinterval from the given WheelOfFortune . |
void |
putBits(long bits,
int length)
Writes the given "raw" bits (by-passes the entropy encoder). |
void |
set(java.lang.String key,
java.lang.Object value)
Sets the given property. |
int |
setContext(int ctx)
Sets the given context as current. |
void |
setMaxSymbol(int maxSymbol)
Sets maximal symbol value for the actual context. |
static int |
setTemplate(Template t,
int ord)
General-purpose registration routine. |
Methods inherited from class cz.cuni.jagrlib.Piece |
---|
className, connect, findPlug, findPlug, getInfo, getInterface, getInterface, getPlug, getReg, init, isCompatible, isCompatible, isConnected, logError, logWarning, myInterface, newInputPlug, newOptOutputPlug, newOutputPlug, newPlug, noTemplates, propBegin, propBounds, propDefault, propEnd, propEnum, propManipulator, propManipulator, setProgressListener, setRegStrings, setTemplateDynamic, stop |
Methods inherited from class cz.cuni.jagrlib.DefaultProperty |
---|
booleanProperty, booleanProperty, colorDoubleProperty, colorProperty, commit, doubleProperty, doubleProperty, doubleProperty, enumProperty, floatProperty, floatProperty, floatProperty, intProperty, intProperty, intProperty, longProperty, longProperty, longProperty, set, stringProperty |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface cz.cuni.jagrlib.iface.Property |
---|
commit |
Field Detail |
---|
protected BitStream stream
null
if the codec is not opened.
protected boolean output
protected ZLIBCodec.OutStream oStream
DeflaterOutputStream
link).
protected ZLIBCodec.InStream iStream
InflaterInputStream
link).
protected int actualCtx
protected java.util.zip.DeflaterOutputStream oCtx
protected java.util.zip.InflaterInputStream iCtx
protected int level
0
(fastest) and 9
(best compression).
Deflater.setLevel(int)
protected int strategy
Deflater.setStrategy(int)
protected long position
protected long rawBits
public static final java.lang.String COMPRESSION_LEVEL
public static final java.lang.String COMPRESSION_STRATEGY
protected static final java.lang.String TEMPLATE_NAME
protected static final java.lang.String CATEGORY
public static final RegPiece reg
Constructor Detail |
---|
public ZLIBCodec()
Method Detail |
---|
public boolean available() throws java.io.IOException
EntropyCodec
available
in interface EntropyCodec
java.io.IOException
EntropyCodec.position()
,
EntropyCodec.compressed()
public void close() throws java.io.IOException
close
in interface EntropyCodec
java.io.IOException
EntropyCodec.open(boolean, int)
,
EntropyCodec.flush()
public long compressed() throws java.io.IOException
EntropyCodec
compressed
in interface EntropyCodec
java.io.IOException
EntropyCodec.position()
public void flush() throws java.io.IOException
EntropyCodec
flush
in interface EntropyCodec
java.io.IOException
EntropyCodec.open(boolean, int)
,
EntropyCodec.close()
public int get() throws java.io.IOException
get
in interface EntropyCodec
-1
if no symbol is available).
java.io.IOException
EntropyCodec.getBits(int)
,
EntropyCodec.put(int)
,
EntropyCodec.available()
public int get(WheelOfFortune wheel) throws java.io.IOException
WheelOfFortune
.
Uses the actual context!
get
in interface EntropyCodec
wheel
- Set of intervals (wheel of fortune).
java.io.IOException
public long getBits(int length) throws java.io.IOException
EntropyCodec
getBits
in interface EntropyCodec
length
- Number of bits to read.
-1
if no bits are available).
java.io.IOException
EntropyCodec.get()
,
EntropyCodec.putBits(long, int)
,
EntropyCodec.available()
public void open(boolean output, int ctx) throws java.io.IOException
EntropyCodec
open
in interface EntropyCodec
output
- Open for output?ctx
- Initial context.
java.io.IOException
BitStream
,
EntropyCodec.setContext(int)
public int getMaxSymbol()
getMaxSymbol
in interface EntropyCodec
255
for ZLIBCodec class).public void setMaxSymbol(int maxSymbol)
setMaxSymbol
in interface EntropyCodec
maxSymbol
- New maximal symbol value.public long position()
EntropyCodec
position
in interface EntropyCodec
EntropyCodec.compressed()
public void put(int symbol) throws java.io.IOException
put
in interface EntropyCodec
symbol
- Symbol to encode.
java.io.IOException
EntropyCodec.putBits(long, int)
,
EntropyCodec.get()
public void put(WheelOfFortune wheel, int s) throws java.io.IOException
WheelOfFortune
.
Uses the actual context!
put
in interface EntropyCodec
wheel
- Set of intervals (wheel of fortune).s
- Index of an interval to encode.
java.io.IOException
public void putBits(long bits, int length) throws java.io.IOException
EntropyCodec
putBits
in interface EntropyCodec
bits
- Bits to be written ("MSB first" order).length
- Number of bits to write.
java.io.IOException
EntropyCodec.put(int)
,
EntropyCodec.getBits(int)
public int setContext(int ctx) throws java.io.IOException
EntropyCodec
setContext
in interface EntropyCodec
ctx
- Id of the new context.
java.io.IOException
public void set(java.lang.String key, java.lang.Object value)
set
in interface Property
set
in class DefaultProperty
key
- Key string.value
- The new value.Property.commit()
public java.lang.Object get(java.lang.String key)
get
in interface Property
get
in class DefaultProperty
key
- Key string.
null
.public static int setTemplate(Template t, int ord)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |