org.apache.maven.util
Class AsyncStreamReader

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.apache.maven.util.AsyncStreamReader
All Implemented Interfaces:
Runnable

public class AsyncStreamReader
extends Thread

A class to asynchronously read the provided InputStream and provide the output as a String

Version:
$Id: AsyncStreamReader.java 532339 2007-04-25 12:28:56Z ltheussl $
Author:
dIon Gillard

Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
AsyncStreamReader(InputStream anInputStream)
          Create a reader to process the provided stream
 
Method Summary
protected  boolean okToConsume(String line)
          Indicate if its ok to consume (add to the buffer) this line.
 void run()
          Read lines from the input stream provided, appending to a buffer for retrieval via the toString() method
 String toString()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AsyncStreamReader

public AsyncStreamReader(InputStream anInputStream)
Create a reader to process the provided stream

Parameters:
anInputStream - any input stream
Method Detail

run

public void run()
Read lines from the input stream provided, appending to a buffer for retrieval via the toString() method


toString

public String toString()
Returns:
the contents of the buffer

okToConsume

protected boolean okToConsume(String line)
Indicate if its ok to consume (add to the buffer) this line. This implementation always returns true.

Parameters:
line - the line to check.
Returns:
if its ok to add this line to the buffer.


Copyright © 2001-2007 Apache Software Foundation. All Rights Reserved.