Class StreamCapturer

java.lang.Object
java.io.OutputStream
org.insa.graphs.gui.StreamCapturer
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

public class StreamCapturer
extends java.io.OutputStream
  • Constructor Summary

    Constructors 
    Constructor Description
    StreamCapturer​(javax.swing.JTextArea output)
    Create a new StreamCapturer without prefix.
    StreamCapturer​(javax.swing.JTextArea output, java.lang.String prefix)  
  • Method Summary

    Modifier and Type Method Description
    java.lang.String getPrefix()  
    void write​(int b)  

    Methods inherited from class java.io.OutputStream

    close, flush, nullOutputStream, write, write

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • StreamCapturer

      public StreamCapturer​(javax.swing.JTextArea output, java.lang.String prefix)
      Parameters:
      output - Output JTextArea to which this stream should print.
      prefix - Prefix to add to each line of this output.
    • StreamCapturer

      public StreamCapturer​(javax.swing.JTextArea output)
      Create a new StreamCapturer without prefix.
      Parameters:
      output - Output JTextArea to which this stream should print.
  • Method Details

    • write

      public void write​(int b) throws java.io.IOException
      Specified by:
      write in class java.io.OutputStream
      Throws:
      java.io.IOException
    • getPrefix

      public java.lang.String getPrefix()
      Returns:
      Formatted prefix, or empty string if no prefix is set.