public class ListenableStream
extends java.io.OutputStream
| Modifier and Type | Field and Description | 
|---|---|
| protected byte[] | bufferThe buffered bytes. | 
| protected int | lenThe currently used length of the buffer. | 
| protected java.util.List | listenersThe listeners. | 
| protected byte[] | newlineThe code(s) of the newline character. | 
| protected java.io.OutputStream | outThe super output stream. | 
| protected java.lang.String | typeThe event type to be generated. | 
| Constructor and Description | 
|---|
| ListenableStream(java.io.OutputStream out,
                java.lang.String type)Create a new stream. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addLineListener(IChangeListener listener)Add a line listener. | 
| void | close()Close the streams. | 
| void | flush()Flush the streams. | 
| protected void | generateEvent()Generate an event for a line
  and flush the buffer. | 
| void | removeLineListener(IChangeListener listener)Remove a line listener. | 
| void | write(int b)Write a byte to the stream. | 
protected java.io.OutputStream out
protected java.lang.String type
protected byte[] buffer
protected int len
protected java.util.List listeners
protected byte[] newline
public ListenableStream(java.io.OutputStream out,
                        java.lang.String type)
out - The output stream.public void write(int b)
           throws java.io.IOException
write in class java.io.OutputStreamb - The byte.java.io.IOExceptionpublic void close()
           throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.OutputStreamjava.io.IOExceptionpublic void flush()
           throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.OutputStreamjava.io.IOExceptionpublic void addLineListener(IChangeListener listener)
public void removeLineListener(IChangeListener listener)
protected void generateEvent()