Package org.eclipse.jetty.util.resource
Class JarFileResource
java.lang.Object
org.eclipse.jetty.util.resource.Resource
org.eclipse.jetty.util.resource.URLResource
org.eclipse.jetty.util.resource.JarResource
org.eclipse.jetty.util.resource.JarFileResource
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ResourceFactory
-
Field Summary
Fields inherited from class org.eclipse.jetty.util.resource.JarResource
_jarConnection
Fields inherited from class org.eclipse.jetty.util.resource.URLResource
_connection, _in, _lock, _url, _urlString
Fields inherited from class org.eclipse.jetty.util.resource.Resource
__defaultUseCaches
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
void
close()
Release any resources held by the resource.boolean
exists()
Returns true if the represented resource exists.boolean
isContainedIn
(Resource resource) Check if this jar:file: resource is contained in the named resource.boolean
long
Returns the last modified timelong
length()
Return the length of the resourceString[]
list()
Returns a list of resource names contained in the given resourceprotected void
Methods inherited from class org.eclipse.jetty.util.resource.JarResource
copyTo, getFile, getInputStream, newJarResource
Methods inherited from class org.eclipse.jetty.util.resource.URLResource
addPath, delete, equals, getInputStream, getName, getReadableByteChannel, getURI, getUseCaches, hashCode, renameTo, toString
Methods inherited from class org.eclipse.jetty.util.resource.Resource
fromList, fromList, getAlias, getAllResources, getAssociate, getDefaultUseCaches, getListHTML, getResource, getWeakETag, getWeakETag, isAlias, isContainedIn, isSame, newClassPathResource, newClassPathResource, newResource, newResource, newResource, newResource, newResource, newResource, newSystemResource, resolveAlias, setAssociate, setDefaultUseCaches, toURL
-
Constructor Details
-
JarFileResource
-
-
Method Details
-
close
public void close()Description copied from class:URLResource
Release any resources held by the resource.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classJarResource
-
checkConnection
protected boolean checkConnection()- Overrides:
checkConnection
in classJarResource
-
newConnection
- Overrides:
newConnection
in classJarResource
- Throws:
IOException
- Sub-classes ofJarResource
may throw an IOException (or subclass)
-
exists
public boolean exists()Returns true if the represented resource exists.- Overrides:
exists
in classJarResource
- Returns:
- true if the represented resource exists.
-
isDirectory
public boolean isDirectory()- Overrides:
isDirectory
in classURLResource
- Returns:
- true if the represented resource is a container/directory.
-
lastModified
public long lastModified()Returns the last modified time- Overrides:
lastModified
in classURLResource
- Returns:
- the last modified time as milliseconds since unix epoch
-
list
Description copied from class:URLResource
Returns a list of resource names contained in the given resource- Overrides:
list
in classURLResource
- Returns:
- a list of resource names contained in the given resource, or null. Note: The resource names are not URL encoded.
-
length
public long length()Return the length of the resource- Overrides:
length
in classURLResource
- Returns:
- the length of the resource
-
isContainedIn
Check if this jar:file: resource is contained in the named resource. Egjar:file:///a/b/c/foo.jar!/x.html
isContainedInfile:///a/b/c/foo.jar
- Overrides:
isContainedIn
in classURLResource
- Parameters:
resource
- the resource to test for- Returns:
- true if resource is contained in the named resource
- Throws:
MalformedURLException
- if unable to process is contained due to invalid URL format
-
getJarFile
-