Class AvroEncoder<T>

    • Constructor Detail

      • AvroEncoder

        public AvroEncoder​(Class<T> clazz,
                           OutputStream os)
                    throws IOException
        Constructor
        Parameters:
        clazz - The java class representing the type to encode
        os - The output stream this encoder is bound to. Not expected to be buffered. Buffering is added internally.
        Throws:
        IOException - In case of an IO error while preparing to write to the output stream
    • Method Detail

      • encode

        public void encode​(T item)
                    throws IOException
        Specified by:
        encode in interface ItemEncoder<T>
        Parameters:
        item - The item to encode into the output stream provided at construction type
        Throws:
        IOException - In case of write error
      • getFactory

        public static <R> EncoderFactory<R> getFactory​(Class<R> clazz)
        Parameters:
        clazz - The java class representing the encoded items' data type
        Returns:
        An encoder factory producing avro encoders based on the given type