Class InputStreamTap
java.lang.Object
java.io.InputStream
org.refcodes.io.InputStreamTap
- All Implemented Interfaces:
Closeable, Flushable, AutoCloseable
The
InputStreamTap decorates an InputStreamTap by tapping
(sniffing data from) an InputStream and besides returning the read
data writes it to the provided OutputStream. In conjunction with the
HexOutputStream the data read from the provided InputStream
via the InputStreamTap may be printed out as Hex codes for debugging
purposes.-
Constructor Summary
ConstructorsConstructorDescriptionInputStreamTap(InputStream aInputStream, OutputStream aOutbutStream) Constructs anInputStreamTapdecorating the providedInputStreamwith tap functionality delegating data to the providedOutputStream. -
Method Summary
Modifier and TypeMethodDescriptionintvoidclose()voidflush()voidmark(int aReadlimit) booleanintread()intread(byte[] bytes) intread(byte[] bytes, int offset, int length) byte[]intreadNBytes(byte[] bytes, int offset, int length) byte[]readNBytes(int length) voidreset()longskip(long aN) voidskipNBytes(long aN) toString()longtransferTo(OutputStream aOut) Methods inherited from class InputStream
nullInputStream
-
Constructor Details
-
InputStreamTap
Constructs anInputStreamTapdecorating the providedInputStreamwith tap functionality delegating data to the providedOutputStream.- Parameters:
aInputStream- TheInputStreamto be decorated.aOutbutStream- TheOutputStreamwhere to also write the read data (from theInputStream) to.
-
-
Method Details
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
readAllBytes
- Overrides:
readAllBytesin classInputStream- Throws:
IOException
-
readNBytes
- Overrides:
readNBytesin classInputStream- Throws:
IOException
-
readNBytes
- Overrides:
readNBytesin classInputStream- Throws:
IOException
-
toString
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-
skipNBytes
- Overrides:
skipNBytesin classInputStream- Throws:
IOException
-
available
- Overrides:
availablein classInputStream- Throws:
IOException
-
mark
public void mark(int aReadlimit) - Overrides:
markin classInputStream
-
reset
- Overrides:
resetin classInputStream- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classInputStream
-
transferTo
- Overrides:
transferToin classInputStream- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-