Modifier and Type | Class and Description |
---|---|
private static class | DemuxOutputStream.BufferInfo
A data class to store information about a buffer. |
Modifier and Type | Field and Description |
---|---|
private WeakHashMap | buffers
Mapping from thread to buffer (Thread to BufferInfo). |
private static final int | CR
Carriage return |
private static final int | INITIAL_SIZE
Initial buffer size. |
private boolean | isErrorStream
Whether or not this stream represents an error stream. |
private static final int | LF
Linefeed |
private static final int | MAX_SIZE
Maximum buffer size. |
private Project | project
The project to send output to. |
Access | Constructor and Description |
---|---|
public | DemuxOutputStream(Project
The project instance for which output is being
demultiplexed. Must not be project, boolean null .true if this is the error string,
otherwise a normal output stream. This is
passed to the project so it knows
which stream it is receiving.Creates a new instance of this class. |
Modifier and Type | Method and Description |
---|---|
public void | close()
Overrides java. Implements java. |
public void | flush()
Overrides java. Implements java. |
private DemuxOutputStream. | Returns: a BufferInfo for the current thread to write data toReturns the buffer associated with the current thread. |
protected void | processBuffer(ByteArrayOutputStream
the ByteArrayOutputStream used to collect the output
until a line separator is seen. buffer)Converts the buffer to a string and sends it to the project. |
protected void | processFlush(ByteArrayOutputStream
the ByteArrayOutputStream used to collect the output
until a line separator is seen. buffer)Converts the buffer to a string and sends it to the project. |
private void | |
private void | |
public void | write(int
data to log (byte). cc)Implements abstract java. |
public void | write(byte[]
the array containing the data b, int the offset into the array where data starts off, int the length of block len)Overrides java. |
buffers | back to summary |
---|---|
private WeakHashMap<Thread, DemuxOutputStream. Mapping from thread to buffer (Thread to BufferInfo). |
CR | back to summary |
---|---|
private static final int CR Carriage return |
INITIAL_SIZE | back to summary |
---|---|
private static final int INITIAL_SIZE Initial buffer size. |
isErrorStream | back to summary |
---|---|
private boolean isErrorStream Whether or not this stream represents an error stream. |
LF | back to summary |
---|---|
private static final int LF Linefeed |
MAX_SIZE | back to summary |
---|---|
private static final int MAX_SIZE Maximum buffer size. |
project | back to summary |
---|---|
private Project project The project to send output to. |
DemuxOutputStream | back to summary |
---|---|
public DemuxOutputStream(Project project, boolean isErrorStream) Creates a new instance of this class.
|
close | back to summary |
---|---|
public void close() throws IOException Overrides java. Implements java. Equivalent to flushing the stream.
|
flush | back to summary |
---|---|
public void flush() throws IOException Overrides java. Implements java. Writes all remaining data in the buffer associated with the current thread to the project.
|
getBufferInfo | back to summary |
---|---|
private DemuxOutputStream. Returns the buffer associated with the current thread.
|
processBuffer | back to summary |
---|---|
protected void processBuffer(ByteArrayOutputStream buffer) Converts the buffer to a string and sends it to the project.
|
processFlush | back to summary |
---|---|
protected void processFlush(ByteArrayOutputStream buffer) Converts the buffer to a string and sends it to the project.
|
removeBuffer | back to summary |
---|---|
private void removeBuffer() Removes the buffer for the current thread. |
resetBufferInfo | back to summary |
---|---|
private void resetBufferInfo() Resets the buffer for the current thread. |
write | back to summary |
---|---|
public void write(int cc) throws IOException Implements abstract java. Writes the data to the buffer and flushes the buffer if a line separator is detected or if the buffer has reached its maximum size.
|
write | back to summary |
---|---|
public void write(byte[] b, int off, int len) throws IOException Overrides java. Write a block of characters to the output stream
|
Modifier and Type | Field and Description |
---|---|
private ByteArrayOutputStream | buffer
The per-thread output stream. |
private boolean | crSeen
Indicates we have just seen a carriage return. |
Access | Constructor and Description |
---|---|
private |
buffer | back to summary |
---|---|
private ByteArrayOutputStream buffer The per-thread output stream. |
crSeen | back to summary |
---|---|
private boolean crSeen Indicates we have just seen a carriage return. It may be part of a crlf pair or a single cr invoking processBuffer twice. |
BufferInfo | back to summary |
---|---|
private BufferInfo() |