org.apache.lucene.util.encoding
Class SimpleIntEncoder
java.lang.Object
org.apache.lucene.util.encoding.IntEncoder
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.
| Fields inherited from class org.apache.lucene.util.encoding.IntEncoder |
out |
SimpleIntEncoder
public SimpleIntEncoder()
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