public class DemuxOutputStream extends OutputStream
Constructor and Description |
---|
DemuxOutputStream(Project project,
boolean isErrorStream)
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Equivalent to flushing the stream.
|
void |
flush()
Writes all remaining data in the buffer associated
with the current thread to the project.
|
protected void |
processBuffer(ByteArrayOutputStream buffer)
Converts the buffer to a string and sends it to the project.
|
protected void |
processFlush(ByteArrayOutputStream buffer)
Converts the buffer to a string and sends it to the project.
|
void |
write(byte[] b,
int off,
int len)
Write a block of characters to the output stream
|
void |
write(int cc)
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
public DemuxOutputStream(Project project, boolean isErrorStream)
project
- The project instance for which output is being
demultiplexed. Must not be null
.isErrorStream
- 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.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
- if there is a problem closing the stream.flush()
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
- if there is a problem flushing the stream.protected void processBuffer(ByteArrayOutputStream buffer)
buffer
- the ByteArrayOutputStream used to collect the output
until a line separator is seen.Project.demuxOutput(String,boolean)
protected void processFlush(ByteArrayOutputStream buffer)
buffer
- the ByteArrayOutputStream used to collect the output
until a line separator is seen.Project.demuxOutput(String,boolean)
public void write(byte[] b, int off, int len) throws IOException
write
in class OutputStream
b
- the array containing the dataoff
- the offset into the array where data startslen
- the length of blockIOException
- if the data cannot be written into the stream.public void write(int cc) throws IOException
write
in class OutputStream
cc
- data to log (byte).IOException
- if the data cannot be written to the stream