Class TextAreaOutputStream

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

    public class TextAreaOutputStream
    extends java.io.OutputStream
    Everything writing to this OutputStream will be shown in a JTextArea.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int offset
      Keeps track of the offset of the text in the text area.
      protected javax.swing.JTextArea text
      The text area to which we want to write.
    • Constructor Summary

      Constructors 
      Constructor Description
      TextAreaOutputStream​(javax.swing.JTextArea text)
      Constructs a TextAreaOutputStream.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Clear the text area.
      void write​(byte[] b)  
      void write​(byte[] b, int off, int len)  
      void write​(int i)  
      • Methods inherited from class java.io.OutputStream

        close, flush, nullOutputStream
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • text

        protected javax.swing.JTextArea text
        The text area to which we want to write.
      • offset

        protected int offset
        Keeps track of the offset of the text in the text area.
    • Constructor Detail

      • TextAreaOutputStream

        public TextAreaOutputStream​(javax.swing.JTextArea text)
        Constructs a TextAreaOutputStream.
        Parameters:
        text - the text area to which we want to write.
    • Method Detail

      • clear

        public void clear()
        Clear the text area.
      • write

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

        public void write​(byte[] b,
                          int off,
                          int len)
        Overrides:
        write in class java.io.OutputStream
        See Also:
        OutputStream.write(byte[], int, int)
      • write

        public void write​(byte[] b)
                   throws java.io.IOException
        Overrides:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
        See Also:
        OutputStream.write(byte[])