Class ColoredTextPaneStream

  • All Implemented Interfaces:
    Closeable, Flushable, AutoCloseable

    public class ColoredTextPaneStream
    extends ByteArrayOutputStream

    A simple stream for outputting a byte stream. This class is a simple addition to the ByteArrayOutputStream class that it implements: whenever something is written to this stream, it will append the bytes. This allows the ColoredTextPane to be written to via an OutputStream, while still ensuring the color properties of the panel.

    Since:
    JTalker 0.2.0
    Version:
    0.0.1
    Author:
    C. William Oswald
    See Also:
    ColoredTextPane, ByteArrayOutputStream
    • Constructor Detail

      • ColoredTextPaneStream

        public ColoredTextPaneStream​(ColoredTextPane text,
                                     int size)
        Creates a new byte array output stream, with the buffer capacity of the specified size, in bytes.
        Parameters:
        text - The pane to append to.
        size - The initial size.
      • ColoredTextPaneStream

        public ColoredTextPaneStream​(ColoredTextPane text)
        Creates a new bytes array output stream, with a buffer capacity of the specified size, in bytes.
        Parameters:
        text - The pane to append to.
    • Method Detail

      • write

        public void write​(byte[] b,
                          int off,
                          int len)
        Writes len bytes from the specified byte array starting off at offset off to this byte array output stream, while appending the byte array selection to the ColoredTextPane provided.
        Overrides:
        write in class ByteArrayOutputStream
        Parameters:
        b - The data.
        off - The start offset in the data.
        len - The number of bytes to write.
      • write

        public void write​(int b)
        Writes the specified byte to this byte array output stream, while appending the byte to the ColoredTextPane provided.
        Overrides:
        write in class ByteArrayOutputStream
        Parameters:
        b - The byte to be written.