org.apache.tools.ant.util

Class LineOrientedOutputStream

Known Direct Subclasses:
LogOutputStream

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

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

Method Details

close

public final void close()
            throws IOException
Writes all remaining

flush

public final void flush()
            throws IOException
Flush this log stream

processBuffer

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

processLine

protected abstract void processLine(String line)
            throws IOException
Processes a line.
Parameters:
line - the line to log.

write

public final void write(byte[] b,
                        int off,
                        int len)
            throws IOException
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

write

public final void write(int cc)
            throws IOException
Write the data to the buffer and flush the buffer, if a line separator is detected.
Parameters:
cc - data to log (byte).