com.ptc.windchill.upgrade.util
Class BufferedLineReader

java.lang.Object
  extended byjava.io.OutputStream
      extended bycom.ptc.windchill.upgrade.util.BufferedLineReader

public class BufferedLineReader
extends OutputStream


Nested Class Summary
private  class BufferedLineReader.BufferedLineInputStream
           
private  class BufferedLineReader.InactivityException
           
private  class BufferedLineReader.Work
           
 
Field Summary
private  BufferedLineReader.BufferedLineInputStream bufferedLineInputStream_
           
private  BufferedReader bufferedReader_
           
private  int ii
           
private  long inactivityTimeout_
           
private  boolean lastLineFound_
           
private  String lastLineInOutputStream_
           
private  Integer lineTerminator_
           
private  Integer lineTerminator2_
           
private  boolean lineTerminatorIsKnown_
           
private  int maybeADeadProcess_
           
private  long maybeADeadProcess2_
           
private  int oldVectorBufferSize_
           
private  boolean performedCloseAll_
           
private  PrintStream printStream_
           
private  boolean test_
           
private  Vector vectorBuffer_
           
 
Constructor Summary
BufferedLineReader(long inactivity_timeout, String last_line)
          Buffer characters until a whole line can be read, but insist that data is actively arriving.
BufferedLineReader(String last_line)
          Buffer characters until a whole line can be read.
 
Method Summary
 void closeAll()
          Used to close prior to reading the lastLineInOutputStream.
 PrintStream createPrintStream()
          Allows for output to be read before execution completes.
private  BufferedReader getBufferedReader()
           
private  InputStream getInputStream()
           
 String readNextLine()
          Read a whole line (an actual line terminator was found).
private  String readOneLineWithTimer(long max_time_diff)
          Used only if the inactivity timeout is non-zero.
 void write(int b)
          Required public by the parent OutputStream class.
 
Methods inherited from class java.io.OutputStream
close, flush, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lastLineFound_

private boolean lastLineFound_

lastLineInOutputStream_

private String lastLineInOutputStream_

inactivityTimeout_

private long inactivityTimeout_

vectorBuffer_

private Vector vectorBuffer_

printStream_

private PrintStream printStream_

performedCloseAll_

private boolean performedCloseAll_

bufferedReader_

private BufferedReader bufferedReader_

bufferedLineInputStream_

private BufferedLineReader.BufferedLineInputStream bufferedLineInputStream_

lineTerminatorIsKnown_

private boolean lineTerminatorIsKnown_

lineTerminator_

private Integer lineTerminator_

lineTerminator2_

private Integer lineTerminator2_

maybeADeadProcess_

private int maybeADeadProcess_

maybeADeadProcess2_

private long maybeADeadProcess2_

oldVectorBufferSize_

private int oldVectorBufferSize_

test_

private boolean test_

ii

private int ii
Constructor Detail

BufferedLineReader

public BufferedLineReader(String last_line)
Buffer characters until a whole line can be read.

Parameters:
last_line - Used to detect the end of usable data (instead of a null).

BufferedLineReader

public BufferedLineReader(long inactivity_timeout,
                          String last_line)
Buffer characters until a whole line can be read, but insist that data is actively arriving.

Parameters:
inactivity_timeout - Max milliseconds to detect each line of data.
last_line - Used to detect the end of usable data (instead of a null).
Method Detail

write

public void write(int b)
Required public by the parent OutputStream class. Write one byte.

Parameters:
b - One byte.

createPrintStream

public PrintStream createPrintStream()
Allows for output to be read before execution completes.

Returns:
Given to the ProcessLauncher class.

readNextLine

public String readNextLine()
                    throws IOException
Read a whole line (an actual line terminator was found).

Returns:
A whole line.
Throws:
IOException - An error occured.

closeAll

public void closeAll()
Used to close prior to reading the lastLineInOutputStream.


getBufferedReader

private BufferedReader getBufferedReader()

getInputStream

private InputStream getInputStream()

readOneLineWithTimer

private String readOneLineWithTimer(long max_time_diff)
                             throws IOException,
                                    BufferedLineReader.InactivityException
Used only if the inactivity timeout is non-zero.

Throws:
IOException
BufferedLineReader.InactivityException