gov.nih.nci.cagrid.testing.system.haste.io
Class ReportLineCollector

java.lang.Object
  extended by java.io.InputStream
      extended by gov.nih.nci.cagrid.testing.system.haste.io.ReportLineCollector
All Implemented Interfaces:
java.io.Closeable, java.lang.Runnable

public class ReportLineCollector
extends java.io.InputStream
implements java.lang.Runnable

ReportLineCollector acts as a special filter on an InputStream, which removes lines beginning with REPORTLINE_PREFIX from the main stream of data and buffers such lines for later, all-at-once access.

Version:
$Revision: 1.1 $

Constructor Summary
ReportLineCollector(java.io.InputStream in)
          Make a new ReportLineCollector that filters (and collects) lines of text that match a certain special reporting patterns.
 
Method Summary
 int available()
          How many bytes can be read without having to block
 java.lang.String getReportLines()
          Return the contents of the report buffer.
 int read()
          Conform to InputStream interface.
 void run()
          Read lines from the incoming data stream, determine if they should be filtered and stored or just passed along, and write the unfiltered lines into the write-end of the pipe.
 
Methods inherited from class java.io.InputStream
close, mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReportLineCollector

public ReportLineCollector(java.io.InputStream in)
                    throws java.io.IOException
Make a new ReportLineCollector that filters (and collects) lines of text that match a certain special reporting patterns.

Throws:
java.io.IOException
Method Detail

run

public void run()
Read lines from the incoming data stream, determine if they should be filtered and stored or just passed along, and write the unfiltered lines into the write-end of the pipe.

Specified by:
run in interface java.lang.Runnable

getReportLines

public java.lang.String getReportLines()
Return the contents of the report buffer.


read

public int read()
         throws java.io.IOException
Conform to InputStream interface. Deliver data that is waiting in the pipe.

Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException

available

public int available()
              throws java.io.IOException
How many bytes can be read without having to block

Overrides:
available in class java.io.InputStream
Throws:
java.io.IOException