Package de.intarsys.tools.stream
Class LogInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- de.intarsys.tools.stream.LogInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class LogInputStream extends java.io.FilterInputStreamAnInputStreamthat logs any char read.This stream is piped in the reading process, any characters read are written to an associated
OutputStreamobject.Client -> LogInputStream -> InputStream -> Source | v OutputStream
-
-
Constructor Summary
Constructors Constructor Description LogInputStream(java.io.InputStream newin, java.io.OutputStream newlog)SplitStream - Konstruktorkommentar.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()java.io.OutputStreamgetLog()intread()Reads the next byte of data from the input stream.intread(byte[] b, int off, int len)Reads up tolenbytes of data from this input stream into an array of bytes.voidsetLog(java.io.OutputStream newLog)-
Methods inherited from class java.io.FilterInputStream
available, mark, markSupported, read, reset, skip
-
-
-
-
Method Detail
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.FilterInputStream- Throws:
java.io.IOException
-
getLog
public java.io.OutputStream getLog()
-
read
public int read() throws java.io.IOExceptionReads the next byte of data from the input stream. The value byte is returned as anintin the range0to255. If no byte is available because the end of the stream has been reached, the value-1is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.A subclass must provide an implementation of this method.
- Overrides:
readin classjava.io.FilterInputStream- Returns:
- the next byte of data, or
-1if the end of the stream is reached. - Throws:
java.io.IOException- if an I/O error occurs.
-
read
public int read(byte[] b, int off, int len) throws java.io.IOExceptionReads up tolenbytes of data from this input stream into an array of bytes. This method blocks until some input is available.This method simply performs
in.read(b, off, len)and returns the result.- Overrides:
readin classjava.io.FilterInputStream- Parameters:
b- the buffer into which the data is read.off- the start offset of the data.len- the maximum number of bytes read.- Returns:
- the total number of bytes read into the buffer, or
-1if there is no more data because the end of the stream has been reached. - Throws:
java.io.IOException- if an I/O error occurs.- See Also:
FilterInputStream.in
-
setLog
public void setLog(java.io.OutputStream newLog)
-
-