Class AnsiOutputStream

java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
java.io.PrintStream
com.github.rvesse.airline.io.output.AnsiOutputStream
All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable
Direct Known Subclasses:
ColorizedOutputStream

public abstract class AnsiOutputStream extends PrintStream
An output stream that supports customized output via ANSI control codes
  • Field Details

  • Constructor Details

    • AnsiOutputStream

      public AnsiOutputStream(OutputStream output)
  • Method Details

    • registerControl

      public final void registerControl(OutputStreamControlTracker control)
      Registers a control

      This method can be useful if you wish to add additional controls beyond those provided by a specific class derived from this abstract class.

      Parameters:
      control - Control
    • registerControls

      public final void registerControls(OutputStreamControlTracker... controls)
      Registers some controls
      Parameters:
      controls - Controls
    • write

      public void write(int b)
      Overrides:
      write in class PrintStream
    • write

      public void write(byte[] b) throws IOException
      Overrides:
      write in class PrintStream
      Throws:
      IOException
    • write

      public void write(byte[] b, int off, int len)
      Overrides:
      write in class PrintStream
    • applyAll

      protected final void applyAll()
      Method which applies any necessary controls to the stream
    • reset

      public void reset(boolean full)
      Resets the stream to the default state i.e. disables all controls that may previously have been applied such as colors, text decorations etc
      Parameters:
      full - If true do a full graphics reset in addition to resetting the individual controls
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class PrintStream
    • resetAll

      protected final void resetAll()
      Method which resets the state of any controls that have been previously enabled and applied to the stream