org.apache.lucene.util.encoding
Class SimpleIntEncoder

java.lang.Object
  extended by org.apache.lucene.util.encoding.IntEncoder
      extended by org.apache.lucene.util.encoding.SimpleIntEncoder

public class SimpleIntEncoder
extends IntEncoder

A simple IntEncoder, writing an integer as 4 raw bytes. *

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

Field Summary
 
Fields inherited from class org.apache.lucene.util.encoding.IntEncoder
out
 
Constructor Summary
SimpleIntEncoder()
           
 
Method Summary
 IntDecoder createMatchingDecoder()
          Returns an IntDecoder which matches this encoder.
 void encode(int value)
          This method makes sure the value wasn't previously encoded by checking against the Set.
 String toString()
           
 
Methods inherited from class org.apache.lucene.util.encoding.IntEncoder
close, reInit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleIntEncoder

public SimpleIntEncoder()
Method Detail

encode

public void encode(int value)
            throws IOException
This method makes sure the value wasn't previously encoded by checking against the Set. If the value wasn't encoded, it's added to the Set, and encoded with {#link Vint8#encode}

Specified by:
encode in class IntEncoder
Parameters:
value - an integer to be encoded
Throws:
IOException - possibly thrown by the OutputStream

createMatchingDecoder

public IntDecoder createMatchingDecoder()
Description copied from class: IntEncoder
Returns an IntDecoder which matches this encoder. Every encoder must return an IntDecoder and null is not a valid value. If an encoder is just a filter, it should at least return its wrapped encoder's matching decoder.

NOTE: this method should create a new instance of the matching decoder and leave the instance sharing to the caller. Returning the same instance over and over is risky because encoders and decoders are not thread safe.

Specified by:
createMatchingDecoder in class IntEncoder

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.