cz.cuni.jagrlib.iface
Interface EntropyCodec

All Superinterfaces:
Property
All Known Implementing Classes:
ArithmeticCodec, HuffmanCodec, LZWCodec, ZLIBCodec

public interface EntropyCodec
extends Property

Abstract entropy codec interface.

Since:
0.04
See Also:
EntropyCodec.java

Field Summary
 
Fields inherited from interface cz.cuni.jagrlib.iface.Property
LOGGING, STATISTICS, TEXT_DESCRIPTION
 
Method Summary
 boolean available()
          Are they any input symbols (bits) available?
 void close()
          Codec close.
 long compressed()
          Actual codec compressed position in bits (total amount in all contexts).
 void flush()
          Codec flush.
 int get()
          Decodes one symbol (using the current context).
 int get(WheelOfFortune wheel)
           
 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)
          Encodes the given symbol (in the current context).
 void put(WheelOfFortune wheel, int s)
           
 void putBits(long bits, int length)
          Writes the given "raw" bits (by-passes the entropy encoder).
 int setContext(int ctx)
          Sets the given context as current.
 void setMaxSymbol(int max)
          Sets maximal symbol value for the actual context and all subsequently created ones.
 
Methods inherited from interface cz.cuni.jagrlib.iface.Property
commit, get, set
 

Method Detail

open

void open(boolean output,
          int ctx)
          throws java.io.IOException
Codec initialization.

Parameters:
output - Open for output?
ctx - Initial context.
Throws:
java.io.IOException
See Also:
BitStream, setContext(int)

setContext

int setContext(int ctx)
               throws java.io.IOException
Sets the given context as current.

Parameters:
ctx - Id of the new context.
Returns:
The old context's id.
Throws:
java.io.IOException

getMaxSymbol

int getMaxSymbol()
Retrieves maximal symbol value for the actual context.

Returns:
Maximal symbol value.

setMaxSymbol

void setMaxSymbol(int max)
Sets maximal symbol value for the actual context and all subsequently created ones. Could be called before open(boolean, int)!

Parameters:
max - New maximal symbol value.

flush

void flush()
           throws java.io.IOException
Codec flush.

Throws:
java.io.IOException
See Also:
open(boolean, int), close()

close

void close()
           throws java.io.IOException
Codec close.

Throws:
java.io.IOException
See Also:
open(boolean, int), flush()

position

long position()
              throws java.io.IOException
Actual codec external position in symbols (total amount in all contexts).

Returns:
Actual codec external position in symbols.
Throws:
java.io.IOException
See Also:
compressed()

compressed

long compressed()
                throws java.io.IOException
Actual codec compressed position in bits (total amount in all contexts).

Returns:
Actual codec compressed position in bits.
Throws:
java.io.IOException
See Also:
position()

available

boolean available()
                  throws java.io.IOException
Are they any input symbols (bits) available?

Returns:
Any symbols (bits) are ready to read.
Throws:
java.io.IOException
See Also:
position(), compressed()

put

void put(int symbol)
         throws java.io.IOException
Encodes the given symbol (in the current context).

Parameters:
symbol - Symbol to encode.
Throws:
java.io.IOException
See Also:
putBits(long, int), get()

put

void put(WheelOfFortune wheel,
         int s)
         throws java.io.IOException
Throws:
java.io.IOException

putBits

void putBits(long bits,
             int length)
             throws java.io.IOException
Writes the given "raw" bits (by-passes the entropy encoder).

Parameters:
bits - Bits to be written ("MSB first" order).
length - Number of bits to write.
Throws:
java.io.IOException
See Also:
put(int), getBits(int)

get

int get()
        throws java.io.IOException
Decodes one symbol (using the current context).

Returns:
Read symbol (-1 if no symbol is available).
Throws:
java.io.IOException
See Also:
getBits(int), put(int), available()

get

int get(WheelOfFortune wheel)
        throws java.io.IOException
Throws:
java.io.IOException

getBits

long getBits(int length)
             throws java.io.IOException
Reads the given amount of "raw" bits (by-passes the entropy decoder).

Parameters:
length - Number of bits to read.
Returns:
Read bits (or -1 if no bits are available).
Throws:
java.io.IOException
See Also:
get(), putBits(long, int), available()