Am 02.03.2009 14:18, Alan Bateman schrieb:
Ulf Zibis wrote:
Sherman, yes, you are right. That's not what I'm looking for.
This would be slower, than reading the stream directly, because the
underlying byte array will be copied 2 times by
BufferedInputStream# + Channels.ReadableByteChannelImpl
Am 02.03.2009 14:13, Tom Hawtin schrieb:
Ulf Zibis wrote:
Anyway, I'm looking for a DirectBuffer directly from a resource file.
So I think there is something missing:
URL.openChannel() or Class#getResourceAsChannel()
Maybe there is a way to get a RamdomAccessFile from URL to get the
Channel
Ulf Zibis wrote:
Sherman, yes, you are right. That's not what I'm looking for.
This would be slower, than reading the stream directly, because the
underlying byte array will be copied 2 times by
BufferedInputStream# + Channels.ReadableByteChannelImpl#read(),
... but maybe not, because looping
Ulf Zibis wrote:
Anyway, I'm looking for a DirectBuffer directly from a resource file.
So I think there is something missing:
URL.openChannel() or Class#getResourceAsChannel()
Maybe there is a way to get a RamdomAccessFile from URL to get the
Channel from. Anybody knows ?
If it's a file URL
Sherman, yes, you are right. That's not what I'm looking for.
This would be slower, than reading the stream directly, because the
underlying byte array will be copied 2 times by
BufferedInputStream# + Channels.ReadableByteChannelImpl#read(),
... but maybe not, because looping BufferedInputStrea
You can use java.nio.channels.Channels.newChannel() to get a
ReadableByteChannel on top of the
InputStream you get from URL.openStream()...
but if my guess of what you want to do is correct, that channel is
probably not that useful:-)
Sherman
Ulf Zibis wrote:
Hi all
there is a { URL getRe
Hi all
there is a { URL getResource(String name) } in class Class.
Does anybody know, how to get a java.nio.channels.Channel or FileChannel
from this URL?
Thanks in advance,
-Ulf