org.apache.solr.common.util

Class JavaBinCodec

  • All Implemented Interfaces:
    Closeable, AutoCloseable, PushWriter
    Direct Known Subclasses:
    JavabinTupleStreamParser, TransactionLog.LogCodec


    public class JavaBinCodec
    extends Object
    implements PushWriter
    Defines a space-efficient serialization/deserialization format for transferring data.

    JavaBinCodec has built in support many commonly used types. This includes primitive types (boolean, byte, short, double, int, long, float), common Java containers/utilities (Date, Map, Collection, Iterator, String, Object[], byte[]), and frequently used Solr types (NamedList, SolrDocument, SolrDocumentList). Each of the above types has a pair of associated methods which read and write that type to a stream.

    Classes that aren't supported natively can still be serialized/deserialized by providing an JavaBinCodec.ObjectResolver object that knows how to work with the unsupported class. This allows JavaBinCodec to be used to marshall/unmarshall arbitrary content.

    NOTE -- JavaBinCodec instances cannot be reused for more than one marshall or unmarshall operation.