On Sun, Jun 7, 2009 at 6:05 PM, Sahoo<[email protected]> wrote: > Stuart McCulloch wrote: >> >> 2009/6/7 Sahoo <[email protected]> >> >> >>> >>> Hi, >>> >>> I see the following code in BundleArchive.java: >>> // Check if the location string represents a reference URL. >>> if ((location != null) && >>> location.startsWith(REFERENCE_PROTOCOL)) >>> { >>> // Reference URLs only support the file protocol. >>> location = location.substring(REFERENCE_PROTOCOL.length()); >>> if (!location.startsWith(FILE_PROTOCOL)) >>> { >>> throw new IOException("Reference URLs can only be files: >>> " + location); >>> } >>> ... >>> >>> Why does reference: scheme only work if the underlying URL represents a >>> file? Can't the code assume that for all other protocols, the underlying >>> stream is a JarInputStream and proceed from there? >>> >>> >> >> how would you use a non-file URL "in-place"? you'd need some way to >> convert >> it to a file location >> otherwise you'd have to copy the stream, which would defeat the purpose of >> using "reference:" >> > > I don't understand how a file URL makes any difference when the actual > resource is a Jar file as opposed to a directory. The code still has to open > a JarInputStream to read it. The same will be the case even when the > resource is not a physical file. > > Secondly, it is my understanding that the code copies embedded jar even for > reference: scheme? Is this not true?
Yes, unless it is an "exploded" jar (i.e., the url points to a directory). I guess the problem is that opening the jar when it is not on the file system would be pretty slow no? regards, Karl > Thanks, > Sahoo > -- Karl Pauls [email protected]
