Package org.apache.lucene.util.encoding
Class IntEncoderFilter
- java.lang.Object
-
- org.apache.lucene.util.encoding.IntEncoder
-
- org.apache.lucene.util.encoding.IntEncoderFilter
-
- Direct Known Subclasses:
DGapIntEncoder,SortingIntEncoder,UniqueValuesIntEncoder
public abstract class IntEncoderFilter extends IntEncoder
An abstract implementation ofIntEncoderwhich is served as a filter on the values to encode. An encoder filter wraps anotherIntEncoderwhich does the actual encoding. This allows for chaining filters and encoders, such as:new UniqueValuesIntEncoder(new DGapIntEncoder(new VInt8IntEnoder()));
UniqueValuesIntEncoderfollowed byDGapIntEncoderThe default implementation implements
close()by closing the wrapped encoder andreInit(OutputStream)by re-initializing the wrapped encoder.- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Field Summary
Fields Modifier and Type Field Description protected IntEncoderencoder-
Fields inherited from class org.apache.lucene.util.encoding.IntEncoder
out
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedIntEncoderFilter(IntEncoder encoder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Instructs the encoder to finish the encoding process.voidreInit(OutputStream out)Reinitializes the encoder with the giveOutputStream.-
Methods inherited from class org.apache.lucene.util.encoding.IntEncoder
createMatchingDecoder, encode
-
-
-
-
Field Detail
-
encoder
protected final IntEncoder encoder
-
-
Constructor Detail
-
IntEncoderFilter
protected IntEncoderFilter(IntEncoder encoder)
-
-
Method Detail
-
close
public void close() throws IOExceptionDescription copied from class:IntEncoderInstructs the encoder to finish the encoding process. This method closes the output stream which was specified byreInit. An implementation may do here additional cleanup required to complete the encoding, such as flushing internal buffers, etc.
Once this method was called, no further calls toencodeshould be made before first callingreInit.NOTE: overriding classes should make sure they either call
super.close()or close the output stream themselves.- Overrides:
closein classIntEncoder- Throws:
IOException
-
reInit
public void reInit(OutputStream out)
Description copied from class:IntEncoderReinitializes the encoder with the giveOutputStream. For re-usability it can be changed without the need to reconstruct a new object.NOTE: after calling
IntEncoder.close(), one must call this method even if the output stream itself hasn't changed. An example case is that the output stream wraps a byte[], and the output stream itself is reset, but its instance hasn't changed. Some implementations ofIntEncodermay write some metadata about themselves to the output stream, and therefore it is imperative that one calls this method before encoding any data.- Overrides:
reInitin classIntEncoder
-
-