org.apache.tools.ant.taskdefs

Class LogOutputStream

public class LogOutputStream extends OutputStream

Logs each line written to this stream to the log system of ant. Tries to be smart about line separators.
TODO: This class can be split to implement other line based processing of data written to the stream.

Since: Ant 1.2

Constructor Summary
LogOutputStream(Task task, int level)
Creates a new instance of this class.
LogOutputStream(ProjectComponent pc, int level)
Creates a new instance of this class.
Method Summary
voidclose()
Writes all remaining
voidflush()
Flush this log stream
intgetMessageLevel()
protected voidprocessBuffer()
Converts the buffer to a string and sends it to processLine
protected voidprocessLine(String line)
Logs a line to the log system of ant.
protected voidprocessLine(String line, int level)
Logs a line to the log system of ant.
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

Constructor Detail

LogOutputStream

public LogOutputStream(Task task, int level)
Creates a new instance of this class.

Parameters: task the task for whom to log level loglevel used to log data written to this stream.

LogOutputStream

public LogOutputStream(ProjectComponent pc, int level)
Creates a new instance of this class.

Parameters: task the task for whom to log level loglevel used to log data written to this stream.

Since: Ant 1.6.3

Method Detail

close

public void close()
Writes all remaining

flush

public void flush()
Flush this log stream

getMessageLevel

public int getMessageLevel()

processBuffer

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

processLine

protected void processLine(String line)
Logs a line to the log system of ant.

Parameters: line the line to log.

processLine

protected void processLine(String line, int level)
Logs a line to the log system of ant.

Parameters: line the line to log.

write

public 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).

write

public 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.

Copyright B) 2000-2007 Apache Software Foundation. All Rights Reserved.