Package org.opentrafficsim.remotecontrol
Class TextAreaOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.opentrafficsim.remotecontrol.TextAreaOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class TextAreaOutputStream extends OutputStream
Output stream that writes to a Swing component. Derived from https://www.codejava.net/java-se/swing/redirect-standard-output-streams-to-jtextareaCopyright (c) 2020-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
awtWrite(byte[] bytes, int offset, int length)
Write to the textArea.void
awtWrite(int b)
Write to the textArea.void
write(byte[] bytes)
void
write(byte[] bytes, int offset, int length)
void
write(int b)
-
Methods inherited from class java.io.OutputStream
close, flush, nullOutputStream
-
-
-
-
Method Detail
-
awtWrite
public void awtWrite(byte[] bytes, int offset, int length)
Write to the textArea. May only be called from within the AWT thread!- Parameters:
bytes
- byte[]; bytes to writeoffset
- int; offset within bytes of the first byte to writelength
- int; number of bytes to write
-
awtWrite
public void awtWrite(int b)
Write to the textArea. May only be called from within the AWT thread!- Parameters:
b
- int; byte to write
-
write
public void write(byte[] bytes, int offset, int length)
- Overrides:
write
in classOutputStream
-
write
public void write(byte[] bytes)
- Overrides:
write
in classOutputStream
-
write
public void write(int b)
- Specified by:
write
in classOutputStream
-
-