In my current project I'm working with an input source that presents a java.nio.SeekableByteChannel, so I figured I'd try skipping the layer of Channels.newInputStream() and write a Buffer implementation that worked directly with ReadableByteChannel. This turned out to be pretty simple after I refactored the common behavior (almost everything, as it turns out) from BoundedInputStreamBuffer into a superclass, StreamingBuffer.
This turned out to not have any measurable performance impact, so I'm inclined to abandon it. If you think it'd be useful, though, I'm happy to add some tests and get it through code review.
In my current project I'm working with an input source that presents a
java.nio.SeekableByteChannel
, so I figured I'd try skipping the layer ofChannels.newInputStream()
and write aBuffer
implementation that worked directly withReadableByteChannel
. This turned out to be pretty simple after I refactored the common behavior (almost everything, as it turns out) fromBoundedInputStreamBuffer
into a superclass,StreamingBuffer
.This turned out to not have any measurable performance impact, so I'm inclined to abandon it. If you think it'd be useful, though, I'm happy to add some tests and get it through code review.