Class TxtEncoderFactory<T>

    • Constructor Detail

      • TxtEncoderFactory

        public TxtEncoderFactory​(Function<T,​String> itemTextualizer,
                                 Charset charset)
        Constructor
        Parameters:
        itemTextualizer - A converter from the object to its textual form
        charset - The charset encoding to use for encoding
      • TxtEncoderFactory

        public TxtEncoderFactory​(Function<T,​String> itemTextualizer)
        Constructor Assumes UTF8 text encoding
        Parameters:
        itemTextualizer - A converter from the object to its textual form
      • TxtEncoderFactory

        public TxtEncoderFactory()
        Constructor Assumes UTF8 text encoding and textualization based on the object's toString()
    • 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