Package io.deephaven.util.channel
Class ChannelPositionInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
io.deephaven.util.channel.ChannelPositionInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
-
Field Summary
Fields inherited from class java.io.FilterInputStream
in
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
static InputStream
of
(SeekableByteChannel channel, InputStream in) Wraps a channel-backed input streamin
, ensuring uponclose()
thatchannel's
SeekableByteChannel.position()
has been advanced the exact amount of bytes that have been consumed from the resulting input stream.Methods inherited from class java.io.FilterInputStream
available, mark, markSupported, read, read, read, reset, skip
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Method Details
-
of
Wraps a channel-backed input streamin
, ensuring uponclose()
thatchannel's
SeekableByteChannel.position()
has been advanced the exact amount of bytes that have been consumed from the resulting input stream.in
is closed duringclose()
; as such, the caller must ensure that closingin
does not closechannel
. To remain valid, the caller must ensure that the resulting input stream isn't re-wrapped by any downstream code in a way that would adversely effect the position (such as wrapping the resulting input stream with buffering).- Parameters:
channel
- the channelin
- the input stream based on the channel- Returns:
- a positional input stream
- Throws:
IOException
- if an IO exception occurs
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterInputStream
- Throws:
IOException
-