org.apache.lucene.util.encoding
Class IntDecoder

java.lang.Object
  extended by org.apache.lucene.util.encoding.IntDecoder
Direct Known Subclasses:
DGapIntDecoder, EightFlagsIntDecoder, FourFlagsIntDecoder, SimpleIntDecoder, VInt8IntDecoder

public abstract class IntDecoder
extends Object

Decodes integers from a set InputStream. For re-usability, the decoder's input stream can be set by (reInit(InputStream)). By design, Decoders are NOT thread-safe.

WARNING: This API is experimental and might change in incompatible ways in the next release.

Field Summary
static long EOS
          A special long value which is used to indicate end-of-stream has reached.
protected  InputStream in
          Input stream from which the encoded bytes are read
 
Constructor Summary
IntDecoder()
           
 
Method Summary
abstract  long decode()
          Decodes data received from the input stream, and returns one decoded integer.
 void reInit(InputStream in)
          Sets the input stream from which the encoded data is read.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EOS

public static final long EOS
A special long value which is used to indicate end-of-stream has reached.

See Also:
Constant Field Values

in

protected InputStream in
Input stream from which the encoded bytes are read

Constructor Detail

IntDecoder

public IntDecoder()
Method Detail

reInit

public void reInit(InputStream in)
Sets the input stream from which the encoded data is read.


decode

public abstract long decode()
                     throws IOException
Decodes data received from the input stream, and returns one decoded integer. If end of stream is reached, EOS is returned.

Returns:
one decoded integer as long or EOS if end-of-stream reached.
Throws:
IOException - if an I/O error occurs