Re: How to get FileChannel from resource

2009-03-02 Thread Ulf Zibis
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

Re: How to get FileChannel from resource

2009-03-02 Thread Ulf Zibis
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

Re: How to get FileChannel from resource

2009-03-02 Thread Alan Bateman
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

Re: How to get FileChannel from resource

2009-03-02 Thread Tom Hawtin
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

Re: How to get FileChannel from resource

2009-03-02 Thread Ulf Zibis
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

Re: How to get FileChannel from resource

2009-03-01 Thread Xueming Shen
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

How to get FileChannel from resource

2009-03-01 Thread Ulf Zibis
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