directory listing in core protocol

David Daney ddaney@avtrex.com
Mon Apr 2 19:11:00 GMT 2007


Ben Tatham wrote:
> Is there a way to examine (or at least the names) of the resources in an 
> elf? Perhaps with readelf?

It it difficult. The name of the resources are not stored in the elf 
symbol table. They are part of the resource data.
Your best bet might be to take a look at the core protocol handler and 
add code to list out all known resources.
David Daney
> Thanks,
> Ben
>> David Daney wrote:
>> Ben Tatham wrote:
>>> Hello All,
>>> Is it possible to get a directory listing of files from the core 
>>> protocol? Currently, I can't even getClass().getResource() to return 
>>> a valid URL for a directory, but it does work if I specify a file.
>>> For example, if I have the following in my jar when I compile
>>>>>> foo
>>> - someResource.txt
>>> adir
>>> - a.txt
>>> - b.txt
>>>>>> I can get an URL for foo/someResource.txt, and I can open an 
>>> InputStream and get the contents.
>>> But if I try getClass().getResource("/foo/adir"), I get null.
>>>> Resources are not really arranged in a directory structure. They have 
>> names with '/' in them and some of the resource methods pre-pend the 
>> package name, but there is no way to list them out.
>>>> David Daney
>


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /