public class JarFileResource extends JarResource
| Modifier and Type | Field and Description |
|---|---|
private boolean |
_directory |
private java.util.jar.JarEntry |
_entry |
private boolean |
_exists |
private java.io.File |
_file |
private java.util.jar.JarFile |
_jarFile |
private java.lang.String |
_jarUrl |
private java.lang.String[] |
_list |
private java.lang.String |
_path |
private static Logger |
LOG |
_jarConnection_connection, _in, _url, _urlString, _useCaches__defaultUseCaches, _associate| Modifier | Constructor and Description |
|---|---|
protected |
JarFileResource(java.net.URL url) |
protected |
JarFileResource(java.net.URL url,
boolean useCaches) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
checkConnection() |
void |
close()
Release any resources held by the resource.
|
boolean |
exists()
Returns true if the represented resource exists.
|
static Resource |
getNonCachingResource(Resource resource)
Take a Resource that possibly might use URLConnection caching
and turn it into one that doesn't.
|
boolean |
isContainedIn(Resource resource)
Check if this jar:file: resource is contained in the
named resource.
|
boolean |
isDirectory()
Returns true if the represented resource is a container/directory.
|
long |
lastModified()
Returns the last modified time
|
long |
length()
Return the length of the resource
|
java.lang.String[] |
list()
Returns a list of resource names contained in the given resource
|
private java.util.List<java.lang.String> |
listEntries() |
protected void |
newConnection() |
copyTo, getFile, getInputStream, newJarResourceaddPath, delete, equals, getInputStream, getName, getReadableByteChannel, getURL, getUseCaches, hashCode, renameTo, toStringencode, finalize, getAlias, getAllResources, getAssociate, getDefaultUseCaches, getListHTML, getResource, getURI, getWeakETag, getWeakETag, isAlias, isContainedIn, newClassPathResource, newClassPathResource, newResource, newResource, newResource, newResource, newResource, newResource, newSystemResource, release, setAssociate, setDefaultUseCaches, toURL, writeToprivate static final Logger LOG
private java.util.jar.JarFile _jarFile
private java.io.File _file
private java.lang.String[] _list
private java.util.jar.JarEntry _entry
private boolean _directory
private java.lang.String _jarUrl
private java.lang.String _path
private boolean _exists
protected JarFileResource(java.net.URL url)
protected JarFileResource(java.net.URL url,
boolean useCaches)
public void close()
URLResourceclose in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class JarResourceprotected boolean checkConnection()
checkConnection in class JarResourceprotected void newConnection()
throws java.io.IOException
newConnection in class JarResourcejava.io.IOException - Sub-classes of JarResource may throw an IOException (or subclass)public boolean exists()
exists in class JarResourcepublic boolean isDirectory()
isDirectory in class URLResourcepublic long lastModified()
lastModified in class URLResourcepublic java.lang.String[] list()
URLResourcelist in class URLResourceprivate java.util.List<java.lang.String> listEntries()
public long length()
length in class URLResourcepublic static Resource getNonCachingResource(Resource resource)
resource - the JarFileResource to obtain without URLConnection caching.public boolean isContainedIn(Resource resource) throws java.net.MalformedURLException
jar:file:///a/b/c/foo.jar!/x.html isContainedIn file:///a/b/c/foo.jarisContainedIn in class URLResourceresource - the resource to test forjava.net.MalformedURLException - if unable to process is contained due to invalid URL format