B
bugbear
In the java.io code set, it's easy to take
a "pile o' data", and put a facade over it
so it looks like a data source.
byte [] stuff;
java.io.InputStream inputStream = new java.io.ByteArrayInputStream(stuff);
In the new and improved world of nio, I would like
(analogously) to present a java.nio.ByteBuffer as a
java.nio.ReadableByteChannel (*).
I cannot find (I've looked **) an obvious way to do this.
Can anyone help?
BugBear
(*) If anyone cares, I actually *need* to present a ByteBuffer
as an InputStream, but the java.nio.channels.Channels
has implements
static InputStream newInputStream(ReadableByteChannel ch)
(**) i.e. I've read and reread the javadoc for java.nio, and googled
a lot.
a "pile o' data", and put a facade over it
so it looks like a data source.
byte [] stuff;
java.io.InputStream inputStream = new java.io.ByteArrayInputStream(stuff);
In the new and improved world of nio, I would like
(analogously) to present a java.nio.ByteBuffer as a
java.nio.ReadableByteChannel (*).
I cannot find (I've looked **) an obvious way to do this.
Can anyone help?
BugBear
(*) If anyone cares, I actually *need* to present a ByteBuffer
as an InputStream, but the java.nio.channels.Channels
has implements
static InputStream newInputStream(ReadableByteChannel ch)
(**) i.e. I've read and reread the javadoc for java.nio, and googled
a lot.