org.apache.tools.ant.taskdefs.optional.perforce
Class P4OutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.apache.tools.ant.taskdefs.optional.perforce.P4OutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class P4OutputStream
extends java.io.OutputStream

heavily inspired from LogOutputStream this stream class calls back the P4Handler on each line of stdout or stderr read


Constructor Summary
P4OutputStream(P4Handler handler)
          creates a new P4OutputStream for a P4Handler
 
Method Summary
 void close()
          Writes all remaining
protected  void processBuffer()
          Converts the buffer to a string and sends it to processLine
 void write(int cc)
          Write the data to the buffer and flush the buffer, if a line separator is detected.
 
Methods inherited from class java.io.OutputStream
flush, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

P4OutputStream

public P4OutputStream(P4Handler handler)
creates a new P4OutputStream for a P4Handler

Parameters:
handler - the handler which will process the streams
Method Detail

write

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

Specified by:
write in class java.io.OutputStream
Parameters:
cc - data to log (byte).
Throws:
java.io.IOException - IOException if an I/O error occurs. In particular, an IOException may be thrown if the output stream has been closed.

processBuffer

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


close

public void close()
           throws java.io.IOException
Writes all remaining

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.OutputStream
Throws:
java.io.IOException - if an I/O error occurs.