Package com.coswald.jtalker.gui
Class ColoredTextPaneStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.ByteArrayOutputStream
-
- com.coswald.jtalker.gui.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 willappend
the bytes. This allows theColoredTextPane
to be written to via anOutputStream
, 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
-
-
Field Summary
-
Fields inherited from class java.io.ByteArrayOutputStream
buf, count
-
-
Constructor Summary
Constructors Constructor Description ColoredTextPaneStream(ColoredTextPane text)
Creates a new bytes array output stream, with a buffer capacity of the specified size, in bytes.ColoredTextPaneStream(ColoredTextPane text, int size)
Creates a new byte array output stream, with the buffer capacity of the specified size, in bytes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
write(byte[] b, int off, int len)
Writeslen
bytes from the specified byte array starting off at offsetoff
to this byte array output stream, while appending the byte array selection to theColoredTextPane
provided.void
write(int b)
Writes the specified byte to this byte array output stream, while appending the byte to theColoredTextPane
provided.-
Methods inherited from class java.io.ByteArrayOutputStream
close, reset, size, toByteArray, toString, toString, toString, toString, writeBytes, writeTo
-
Methods inherited from class java.io.OutputStream
flush, nullOutputStream, write
-
-
-
-
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)
Writeslen
bytes from the specified byte array starting off at offsetoff
to this byte array output stream, while appending the byte array selection to theColoredTextPane
provided.- Overrides:
write
in classByteArrayOutputStream
- 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 theColoredTextPane
provided.- Overrides:
write
in classByteArrayOutputStream
- Parameters:
b
- The byte to be written.
-
-