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
public class JarResource extends URLResource
-
-
Field Summary
Fields Modifier and Type Field Description protected JarURLConnection_jarConnection-
Fields inherited from class org.eclipse.jetty.util.resource.URLResource
_connection, _in, _url, _urlString
-
Fields inherited from class org.eclipse.jetty.util.resource.Resource
__defaultUseCaches
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedJarResource(URL url)protectedJarResource(URL url, boolean useCaches)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancheckConnection()voidclose()Release any resources held by the resource.voidcopyTo(File directory)Copy the Resource to the new destination file.booleanexists()Returns true if the represented resource exists.FilegetFile()Returns an File representing the given resource or NULL if this is not possible.InputStreamgetInputStream()Returns an input stream to the resource.protected voidnewConnection()static ResourcenewJarResource(Resource resource)-
Methods inherited from class org.eclipse.jetty.util.resource.URLResource
addPath, delete, equals, getInputStream, getName, getReadableByteChannel, getURL, getUseCaches, hashCode, isContainedIn, isDirectory, lastModified, length, list, renameTo, toString
-
Methods inherited from class org.eclipse.jetty.util.resource.Resource
encode, 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, writeTo
-
-
-
-
Field Detail
-
_jarConnection
protected JarURLConnection _jarConnection
-
-
Method Detail
-
close
public void close()
Description copied from class:URLResourceRelease any resources held by the resource.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classURLResource
-
checkConnection
protected boolean checkConnection()
- Overrides:
checkConnectionin classURLResource
-
newConnection
protected void newConnection() throws IOException- Throws:
IOException- Sub-classes ofJarResourcemay throw an IOException (or subclass)
-
exists
public boolean exists()
Returns true if the represented resource exists.- Overrides:
existsin classURLResource- Returns:
- true if the represented resource exists.
-
getFile
public File getFile() throws IOException
Description copied from class:URLResourceReturns an File representing the given resource or NULL if this is not possible.- Overrides:
getFilein 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
public InputStream getInputStream() throws IOException
Description copied from class:URLResourceReturns an input stream to the resource. The underlying url connection will be nulled out to prevent re-use.- Overrides:
getInputStreamin classURLResource- Returns:
- an input stream to the resource
- Throws:
IOException- if unable to open the input stream
-
copyTo
public void copyTo(File directory) throws IOException
Description copied from class:ResourceCopy the Resource to the new destination file.Will not replace existing destination file.
- Overrides:
copyToin classResource- Parameters:
directory- the destination file to create- Throws:
IOException- if unable to copy the resource
-
newJarResource
public static Resource newJarResource(Resource resource) throws IOException
- Throws:
IOException
-
-