How to get FileChannel from resource (original) (raw)
Tom Hawtin Thomas.Hawtin at Sun.COM
Mon Mar 2 13:13:36 UTC 2009
- Previous message: How to get FileChannel from resource
- Next message: How to get FileChannel from resource
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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, then obviously you can check the protocol and create
a File
from the file portion. However most resources are not stored in
naked files.
For jared resources, you can cast the URLConnection to JarURLConnection and call getJarFile. Some implementations of JarURLConnection may not return a JarFile.
Tom Hawtin
- Previous message: How to get FileChannel from resource
- Next message: How to get FileChannel from resource
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]