com.isti.util
Class LineProcOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended bycom.isti.util.LineProcOutputStream
All Implemented Interfaces:
CallBackStringParam
Direct Known Subclasses:
LogOutputStream

public abstract class LineProcOutputStream
extends java.io.OutputStream
implements CallBackStringParam

Title: LineProcOutputStream

Description: Abstract class that can be dropped in, in place of any OutputStream class (stdout for example), to handle character-stream data as lines. A user-supplied call-back method is handed one line of data at a time.


Field Summary
protected  java.lang.String EOL
          String defining what newline char(s) looks like.
protected  int EOL_LEN
          Length of newline char(s).
protected  java.lang.StringBuffer lineBuffer
          Where we keep the current line.
 
Constructor Summary
LineProcOutputStream()
           
 
Method Summary
 void flush()
          Send buffer content to call-back method (if not empty).
 void write(int ch)
          Enters the given character into the output stream.
 
Methods inherited from class java.io.OutputStream
close, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.isti.util.CallBackStringParam
callBackMethod
 

Field Detail

lineBuffer

protected final java.lang.StringBuffer lineBuffer
Where we keep the current line.


EOL

protected final java.lang.String EOL
String defining what newline char(s) looks like.

See Also:
Constant Field Values

EOL_LEN

protected final int EOL_LEN
Length of newline char(s).

Constructor Detail

LineProcOutputStream

public LineProcOutputStream()
Method Detail

write

public void write(int ch)
Enters the given character into the output stream. The characters are buffered until a newline ('\n') character is encountered; then the entire line of characters (including the newline) is sent to the call-back method.

Parameters:
ch - the character to enter.

flush

public void flush()
Send buffer content to call-back method (if not empty).