Class AvroDecoder<T>

    • Constructor Detail

      • AvroDecoder

        public AvroDecoder​(Class<T> clazz,
                           InputStream is)
                    throws IOException
        Constructor.
        Parameters:
        clazz - The java class the bytes will be decoded to.
        is - The input stream to bound to this decoder. Not expected to be buffered.
        Throws:
        IOException - In case of an IO error while preparing to read from the input stream
    • Method Detail

      • decode

        public T decode()
                 throws IOException
        Description copied from interface: ItemDecoder
        Reads and decodes the next object from the input stream.
        Specified by:
        decode in interface ItemDecoder<T>
        Returns:
        The decoded item from the input stream provided on construction, or null if end of stream was reached
        Throws:
        IOException - In case of a read error
      • getFactory

        public static <R> DecoderFactory<R> getFactory​(Class<R> clazz)
        Parameters:
        clazz - The java class representing the decoded items' data type
        Returns:
        A decoder factory producing avro decoders based on the given type