Class TextStreamOutput

  • All Implemented Interfaces:
    Output<java.lang.String>, java.io.Closeable, java.lang.AutoCloseable
    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 com.github.akurilov.commons.io.Output

        getInput
    • Field Detail

      • writer

        protected final java.io.BufferedWriter writer
    • Constructor Detail

      • TextStreamOutput

        public TextStreamOutput​(java.io.OutputStream out)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • TextStreamOutput

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

      • put

        public boolean put​(java.lang.String line)
                    throws java.io.IOException
        Description copied from interface: Output
        Write the data item
        Specified by:
        put in interface Output<java.lang.String>
        Parameters:
        line - the item to put
        Throws:
        java.io.IOException - if fails some-why
      • put

        public int put​(java.util.List<java.lang.String> lines,
                       int from,
                       int to)
                throws java.io.IOException
        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)
                throws java.io.IOException
        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()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException