org.apache.tools.ant.util

Class LineOrientedOutputStream

public abstract class LineOrientedOutputStream extends OutputStream

Invokes processLine whenever a full line has been written to this stream.

Tries to be smart about line separators.

Method Summary
voidclose()
Writes all remaining
voidflush()
Flush this log stream
protected voidprocessBuffer()
Converts the buffer to a string and sends it to processLine
protected abstract voidprocessLine(String line)
Processes a line.
voidwrite(int cc)
Write the data to the buffer and flush the buffer, if a line separator is detected.
voidwrite(byte[] b, int off, int len)
Write a block of characters to the output stream

Method Detail

close

public final void close()
Writes all remaining

Throws: IOException if there is an error.

flush

public final void flush()
Flush this log stream

Throws: IOException if there is an error.

processBuffer

protected void processBuffer()
Converts the buffer to a string and sends it to processLine

Throws: IOException if there is an error.

processLine

protected abstract void processLine(String line)
Processes a line.

Parameters: line the line to log.

Throws: IOException if there is an error.

write

public final void write(int cc)
Write the data to the buffer and flush the buffer, if a line separator is detected.

Parameters: cc data to log (byte).

Throws: IOException if there is an error.

write

public final void write(byte[] b, int off, int len)
Write a block of characters to the output stream

Parameters: b the array containing the data off the offset into the array where data starts len the length of block

Throws: IOException if the data cannot be written into the stream.