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 TypeMethodDescriptionvoidclose()static InputStreamof(SeekableByteChannel channel, InputStream in) Wraps a channel-backed input streamin, ensuring uponclose()thatchannel'sSeekableByteChannel.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, skipMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Method Details
-
of
Wraps a channel-backed input streamin, ensuring uponclose()thatchannel'sSeekableByteChannel.position()has been advanced the exact amount of bytes that have been consumed from the resulting input stream.inis closed duringclose(); as such, the caller must ensure that closingindoes 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterInputStream- Throws:
IOException
-