Class PrintAboveWriter

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.Appendable, java.lang.AutoCloseable

    public class PrintAboveWriter
    extends java.io.StringWriter
    Redirects a Writer to a LineReader's LineReader.printAbove(String) method, which draws output above the current prompt / input line.

    Example:

         LineReader reader = LineReaderBuilder.builder().terminal(terminal).parser(parser).build();
         PrintAboveWriter printAbove = new PrintAboveWriter(reader);
         printAbove.write(new char[] { 'h', 'i', '!', '\n'});
     
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private LineReader reader  
      • Fields inherited from class java.io.Writer

        lock
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void flush()  
      • Methods inherited from class java.io.StringWriter

        append, append, append, close, getBuffer, toString, write, write, write, write
      • Methods inherited from class java.io.Writer

        nullWriter, write
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • PrintAboveWriter

        public PrintAboveWriter​(LineReader reader)
    • Method Detail

      • flush

        public void flush()
        Specified by:
        flush in interface java.io.Flushable
        Overrides:
        flush in class java.io.StringWriter