Class SimpleIntEncoder

  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
Constructor Summary
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


public SimpleIntEncoder()
Method Detail


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
value - an integer to be encoded
IOException - possibly thrown by the OutputStream


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


public String toString()
toString in class Object

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