Class TxtDecoderFactory<T>

  • Type Parameters:
    T - The data type of the decoded items
    All Implemented Interfaces:
    DecoderFactory<T>

    public class TxtDecoderFactory<T>
    extends Object
    implements DecoderFactory<T>
    An DecoderFactory that decodes items from a textual form, assuming that items are delimited by "\n". See also TxtEncoderFactory.
    Author:
    Eyal Schneider
    • Constructor Detail

      • TxtDecoderFactory

        public TxtDecoderFactory​(FailableFunction<String,​T,​? extends ValidationPipeException> itemDetextualizer,
                                 Charset charset)
        Constructor
        Parameters:
        itemDetextualizer - A converter from the textual form to the item itself
        charset - The charset encoding to use for decoding
      • TxtDecoderFactory

        public TxtDecoderFactory​(FailableFunction<String,​T,​? extends ValidationPipeException> itemDetextualizer)
        Constructor Assumes UTF8 text encoding.
        Parameters:
        itemDetextualizer - A converter from the textual form to the item itself
    • Method Detail

      • 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