Class AvroCodecFactory<T>

  • Type Parameters:
    T - The data type we wish to encode/decode
    All Implemented Interfaces:
    CodecFactory<T>, DecoderFactory<T>, EncoderFactory<T>

    public class AvroCodecFactory<T>
    extends Object
    implements CodecFactory<T>
    A codec factory for AVRO format. Bound to a data type provided at factory creation time.
    Author:
    Eyal Schneider
    • Constructor Detail

      • AvroCodecFactory

        public AvroCodecFactory​(Class<T> clazz)
        Constructor
        Parameters:
        clazz - The java class representing the type to encode
    • Method Detail

      • newEncoder

        public ItemEncoder<T> newEncoder​(OutputStream os,
                                         FileWriteOptions writeOptions)
                                  throws IOException
        Specified by:
        newEncoder in interface EncoderFactory<T>
        Parameters:
        os - The output stream the encoder should be bound to. Not expected to be buffered. The encoder handles buffering.
        writeOptions - The way the output stream should be handled
        Returns:
        The new encoder
        Throws:
        IOException - In case of an IO error while preparing to write to the output stream
      • newDecoder

        public ItemDecoder<T> newDecoder​(InputStream is,
                                         FileReadOptions readOptions)
                                  throws IOException
        Specified by:
        newDecoder in interface DecoderFactory<T>
        Parameters:
        is - The input stream the decoder should be bound to. Not expected to be buffered. Buffering is added by the decoder.
        readOptions - defines how the input stream should be handled
        Returns:
        The new decoder
        Throws:
        IOException - In case of an IO error while preparing to read from the input stream