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
ConstructorDescriptionInputStreamTap
(InputStream aInputStream, OutputStream aOutbutStream) Constructs anInputStreamTap
decorating the providedInputStream
with tap functionality delegating data to the providedOutputStream
. -
Method Summary
Modifier and TypeMethodDescriptionint
void
close()
void
flush()
void
mark
(int aReadlimit) boolean
int
read()
int
read
(byte[] bytes) int
read
(byte[] bytes, int offset, int length) byte[]
int
readNBytes
(byte[] bytes, int offset, int length) byte[]
readNBytes
(int length) void
reset()
long
skip
(long aN) void
skipNBytes
(long aN) toString()
long
transferTo
(OutputStream aOut) Methods inherited from class java.io.InputStream
nullInputStream
-
Constructor Details
-
InputStreamTap
Constructs anInputStreamTap
decorating the providedInputStream
with tap functionality delegating data to the providedOutputStream
.- Parameters:
aInputStream
- TheInputStream
to be decorated.aOutbutStream
- TheOutputStream
where to also write the read data (from theInputStream
) to.
-
-
Method Details
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
readAllBytes
- Overrides:
readAllBytes
in classInputStream
- Throws:
IOException
-
readNBytes
- Overrides:
readNBytes
in classInputStream
- Throws:
IOException
-
readNBytes
- Overrides:
readNBytes
in classInputStream
- Throws:
IOException
-
toString
-
skip
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
skipNBytes
- Overrides:
skipNBytes
in classInputStream
- Throws:
IOException
-
available
- Overrides:
available
in classInputStream
- Throws:
IOException
-
mark
public void mark(int aReadlimit) - Overrides:
mark
in classInputStream
-
reset
- Overrides:
reset
in classInputStream
- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupported
in classInputStream
-
transferTo
- Overrides:
transferTo
in classInputStream
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceFlushable
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-