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
ByteArrayOutputStreamclass that it implements: whenever something is written to this stream, it willappendthe bytes. This allows theColoredTextPaneto 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 voidwrite(byte[] b, int off, int len)Writeslenbytes from the specified byte array starting off at offsetoffto this byte array output stream, while appending the byte array selection to theColoredTextPaneprovided.voidwrite(int b)Writes the specified byte to this byte array output stream, while appending the byte to theColoredTextPaneprovided.-
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)Writeslenbytes from the specified byte array starting off at offsetoffto this byte array output stream, while appending the byte array selection to theColoredTextPaneprovided.- Overrides:
writein 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 theColoredTextPaneprovided.- Overrides:
writein classByteArrayOutputStream- Parameters:
b- The byte to be written.
-
-