Package org.eclipse.jetty.util.resource
Class JarResource
java.lang.Object
org.eclipse.jetty.util.resource.Resource
org.eclipse.jetty.util.resource.URLResource
org.eclipse.jetty.util.resource.JarResource
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ResourceFactory
- Direct Known Subclasses:
JarFileResource
-
Field Summary
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
ModifierConstructorDescriptionprotected
JarResource
(URL url) protected
JarResource
(URL url, boolean useCaches) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
void
close()
Release any resources held by the resource.void
Copy the Resource to the new destination file.boolean
exists()
Returns true if the represented resource exists.getFile()
Returns an File representing the given resource or NULL if this is not possible.Returns an input stream to the resource.protected void
static Resource
newJarResource
(Resource resource) Methods inherited from class org.eclipse.jetty.util.resource.URLResource
addPath, delete, equals, getInputStream, getName, getReadableByteChannel, getURI, getUseCaches, hashCode, isContainedIn, isDirectory, lastModified, length, list, 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
-
Field Details
-
_jarConnection
-
-
Constructor Details
-
JarResource
-
JarResource
-
-
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 classURLResource
-
checkConnection
protected boolean checkConnection()- Overrides:
checkConnection
in classURLResource
-
newConnection
- 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 classURLResource
- Returns:
- true if the represented resource exists.
-
getFile
Description copied from class:URLResource
Returns an File representing the given resource or NULL if this is not possible.- Overrides:
getFile
in classURLResource
- Returns:
- an File representing the given resource or NULL if this is not possible.
- Throws:
IOException
- if unable to get the resource due to permissions
-
getInputStream
Description copied from class:URLResource
Returns an input stream to the resource. The underlying url connection will be nulled out to prevent re-use.- Overrides:
getInputStream
in classURLResource
- Returns:
- an input stream to the resource
- Throws:
IOException
- if unable to open the input stream
-
copyTo
Description copied from class:Resource
Copy the Resource to the new destination file.Will not replace existing destination file.
- Overrides:
copyTo
in classResource
- Parameters:
directory
- the destination file to create- Throws:
IOException
- if unable to copy the resource
-
newJarResource
- Throws:
IOException
-