Class TextStreamOutput

  • All Implemented Interfaces:
    Output<java.lang.String>, java.lang.AutoCloseable, java.util.function.Consumer<java.lang.String>
    Direct Known Subclasses:
    TextFileOutput

    public abstract class TextStreamOutput
    extends java.lang.Object
    implements Output<java.lang.String>
    The input implementation designed to write the text lines using BufferedWriter
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.io.BufferedWriter writer  
    • Constructor Summary

      Constructors 
      Constructor Description
      TextStreamOutput​(java.io.OutputStream out)  
      TextStreamOutput​(java.io.OutputStream out, int buffSize)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      boolean put​(java.lang.String line)
      Write the data item
      int put​(java.util.List<java.lang.String> lines)
      Uses the thread local string builder to concatenate the lines into the single text block for better performance
      int put​(java.util.List<java.lang.String> lines, int from, int to)
      Uses the thread local string builder to concatenate the lines into the single text block for better performance
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.function.Consumer

        andThen
    • Field Detail

      • writer

        protected final java.io.BufferedWriter writer
    • Constructor Detail

      • TextStreamOutput

        public TextStreamOutput​(java.io.OutputStream out)
      • TextStreamOutput

        public TextStreamOutput​(java.io.OutputStream out,
                                int buffSize)
    • Method Detail

      • put

        public boolean put​(java.lang.String line)
        Description copied from interface: Output
        Write the data item
        Specified by:
        put in interface Output<java.lang.String>
        Parameters:
        line - the item to put
      • put

        public int put​(java.util.List<java.lang.String> lines,
                       int from,
                       int to)
        Uses the thread local string builder to concatenate the lines into the single text block for better performance
        Specified by:
        put in interface Output<java.lang.String>
        Parameters:
        lines - the buffer containing the items to put
        Returns:
        the count of the items successfully written
        Throws:
        java.io.IOException
      • put

        public int put​(java.util.List<java.lang.String> lines)
        Uses the thread local string builder to concatenate the lines into the single text block for better performance
        Specified by:
        put in interface Output<java.lang.String>
        Throws:
        java.io.IOException
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable