Discussion: #ResourceExistenceAndSize
    mark.reinhold at oracle.com 
    mark.reinhold at oracle.com
       
    Tue Jul 19 21:08:08 UTC 2016
    
    
  
2016/7/13 9:22:43 -0700, david.lloyd at redhat.com:
> On 07/13/2016 09:29 AM, mark.reinhold at oracle.com wrote:
>> Reference: http://openjdk.java.net/projects/jigsaw/spec/issues/#ResourceExistenceAndSize
>> 
>> ...
>> 
>> At any rate, I don't see anything here that's inherently part of the
>> design of the module system, so I intend to close this issue as
>> unrelated.
> 
> The relation comes in because Class and ClassLoader have a way to open a 
> resource with a URL, but Module does not, providing only a 
> getResourceAsStream() method.  Adding a getResource() method would be 
> one solution, but the underlying requirement is really that the resource 
> existence and size (and origin) could/should be queriable as well, so 
> that was the issue I registered, especially as URL is really not a great 
> solution to this problem.
So would a simple Module::getResourceSize(String name) method, which
returns a long value to indicate the size of the named resource, or
else -1 if it doesn't exist, be sufficient?
We could consider adding a similar method alongside the other existing
getResource* methods in java.lang.Class and ClassLoader.
- Mark
    
    
More information about the jpms-spec-observers
mailing list