|
||||||||||
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.LZWCodec
public class LZWCodec
LZW codec.
Nested Class Summary | |
---|---|
protected static class |
LZWCodec.InsertResult
|
protected class |
LZWCodec.LZWTrie
Dictionary implemented by trie-like structure (represented by binary tree - first son is son, second one is brother) each entry holds only one character. |
Field Summary | |
---|---|
protected int |
actualCtx
Id of the actual context. |
protected static java.lang.String |
CATEGORY
Object category. |
protected LZWCodec.LZWTrie |
ctx
Working context (= dictionary). |
protected int |
defaultMaxSymbol
Default alphabet size (for new context creation). |
static java.lang.String |
MAX_CODE_SIZE
|
protected int |
maxCodeSize
Maximal codeword size in bits. |
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 BitStream |
stream
Associated I/O stream. |
protected static java.lang.String |
TEMPLATE_NAME
Object template identifier. |
static java.lang.String |
VARIABLE_CODE
|
protected boolean |
variableCode
Use variable-code implementation? |
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 | |
---|---|
LZWCodec()
|
Method Summary | |
---|---|
boolean |
available()
Are they any input symbols (bits) available? |
void |
close()
Close stream, clean statistics, write out the EOD code.. |
long |
compressed()
Actual codec compressed position in bits (total amount in all contexts). |
void |
flush()
Codec flush. |
int |
get()
Get the 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 dCtx)
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 ctxId)
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
protected boolean output
protected int actualCtx
protected LZWCodec.LZWTrie ctx
protected boolean variableCode
protected int maxCodeSize
protected long position
protected long rawBits
protected int defaultMaxSymbol
public static final java.lang.String VARIABLE_CODE
public static final java.lang.String MAX_CODE_SIZE
protected static final java.lang.String TEMPLATE_NAME
protected static final java.lang.String CATEGORY
public static final RegPiece reg
Constructor Detail |
---|
public LZWCodec()
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 dCtx) throws java.io.IOException
EntropyCodec
open
in interface EntropyCodec
output
- Open for output?dCtx
- Initial context.
java.io.IOException
BitStream
,
EntropyCodec.setContext(int)
public int getMaxSymbol()
getMaxSymbol
in interface EntropyCodec
public void setMaxSymbol(int maxSymbol)
setMaxSymbol
in interface EntropyCodec
maxSymbol
- New maximal symbol value.public long position() throws java.io.IOException
EntropyCodec
position
in interface EntropyCodec
java.io.IOException
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 ctxId)
EntropyCodec
setContext
in interface EntropyCodec
ctxId
- Id of the new context.
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 |