public class JarURLConnectionImpl extends JarURLConnection
URLConnection.
This class is responsible for connecting and retrieving resources from a Jar file which can be anywhere that can be referred to by an URL.
jarFileURLConnectionallowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches| Constructor and Description |
|---|
JarURLConnectionImpl(URL url) |
| Modifier and Type | Method and Description |
|---|---|
void |
connect()
Opens a connection to the resource.
|
Object |
getContent()
Returns the object pointed by this
URL. |
int |
getContentLength()
Returns the content length of the resource.
|
String |
getContentType()
Returns the content type of the resource.
|
boolean |
getDefaultUseCaches()
Returns the default setting whether this connection allows using caches.
|
InputStream |
getInputStream()
Creates an input stream for reading from this URL Connection.
|
JarEntry |
getJarEntry()
Returns the JarEntry of the entry referenced by this
URLConnection. |
JarFile |
getJarFile()
Returns the Jar file referred by this
URLConnection. |
Permission |
getPermission()
Returns the permission, in this case the subclass, FilePermission object
which represents the permission necessary for this URLConnection to
establish the connection.
|
boolean |
getUseCaches()
Returns the value of the flag which specifies whether this
URLConnection allows to use caches. |
void |
setDefaultUseCaches(boolean defaultusecaches)
Sets the default value for the flag indicating whether this connection
allows to use caches.
|
void |
setUseCaches(boolean usecaches)
Sets the flag indicating whether this connection allows to use caches or
not.
|
getAttributes, getCertificates, getEntryName, getJarFileURL, getMainAttributes, getManifestaddRequestProperty, getAllowUserInteraction, getConnectTimeout, getContent, getContentEncoding, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getHeaderFields, getIfModifiedSince, getLastModified, getOutputStream, getReadTimeout, getRequestProperties, getRequestProperty, getURL, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setReadTimeout, setRequestProperty, toStringpublic JarURLConnectionImpl(URL url) throws MalformedURLException, IOException
url - the URL of the JARMalformedURLException - if the URL is malformedIOException - if there is a problem opening the connection.public void connect()
throws IOException
URLConnectionconnect in class URLConnectionIOException - if an error occurs while connecting to the resource.URLConnection.connect()public JarFile getJarFile() throws IOException
URLConnection.getJarFile in class JarURLConnectionIOException - thrown if an IO error occurs while connecting to the
resource.public JarEntry getJarEntry() throws IOException
URLConnection.getJarEntry in class JarURLConnectionIOException - if an IO error occurs while getting the entrypublic InputStream getInputStream() throws IOException
getInputStream in class URLConnectionIOException - if an IO error occurs while connecting to the resource.public String getContentType()
getContentType in class URLConnectionpublic int getContentLength()
int. Otherwise, it will
return -1.getContentLength in class URLConnectionpublic Object getContent() throws IOException
URL. If this URLConnection is
pointing to a Jar File (no Jar Entry), this method will return a JarFile If there is a Jar Entry, it will return the object corresponding
to the Jar entry content type.getContent in class URLConnectionIOException - if an IO error occurredContentHandler,
ContentHandlerFactory,
IOException,
URLConnection.setContentHandlerFactory(ContentHandlerFactory)public Permission getPermission() throws IOException
getPermission in class URLConnectionIOException - thrown when an IO exception occurs while creating the
permission.public boolean getUseCaches()
URLConnectionURLConnection allows to use caches.getUseCaches in class URLConnectiontrue if using caches is allowed, false otherwise.public void setUseCaches(boolean usecaches)
URLConnectionsetUseCaches in class URLConnectionusecaches - the value of the flag to be set.URLConnection.useCachespublic boolean getDefaultUseCaches()
URLConnectiongetDefaultUseCaches in class URLConnectiondefaultUseCaches.URLConnection.useCachespublic void setDefaultUseCaches(boolean defaultusecaches)
URLConnectionURLConnections are unaffected.setDefaultUseCaches in class URLConnectiondefaultusecaches - the default value of the flag to be used for new connections.URLConnection.useCaches