| Method from sun.net.www.protocol.jar.JarURLConnection Detail: |
public void addRequestProperty(String key,
String value) {
jarFileURLConnection.addRequestProperty(key, value);
}
Adds a general request property specified by a
key-value pair. This method will not overwrite
existing values associated with the same key. |
public void connect() throws IOException {
if (!connected) {
/* the factory call will do the security checks */
jarFile = factory.get(getJarFileURL(), getUseCaches());
/* we also ask the factory the permission that was required
* to get the jarFile, and set it as our permission.
*/
if (getUseCaches()) {
jarFileURLConnection = factory.getConnection(jarFile);
}
if ((entryName != null)) {
jarEntry = (JarEntry)jarFile.getEntry(entryName);
if (jarEntry == null) {
try {
if (!getUseCaches()) {
jarFile.close();
}
} catch (Exception e) {
}
throw new FileNotFoundException("JAR entry " + entryName +
" not found in " +
jarFile.getName());
}
}
connected = true;
}
}
|
public boolean getAllowUserInteraction() {
return jarFileURLConnection.getAllowUserInteraction();
}
Returns the value of the allowUserInteraction field for
this object. |
public Object getContent() throws IOException {
Object result = null;
connect();
if (entryName == null) {
result = jarFile;
} else {
result = super.getContent();
}
return result;
}
|
public int getContentLength() {
long result = getContentLengthLong();
if (result > Integer.MAX_VALUE)
return -1;
return (int) result;
}
|
public long getContentLengthLong() {
long result = -1;
try {
connect();
if (jarEntry == null) {
/* if the URL referes to an archive */
result = jarFileURLConnection.getContentLengthLong();
} else {
/* if the URL referes to an archive entry */
result = getJarEntry().getSize();
}
} catch (IOException e) {
}
return result;
}
|
public String getContentType() {
if (contentType == null) {
if (entryName == null) {
contentType = "x-java/jar";
} else {
try {
connect();
InputStream in = jarFile.getInputStream(jarEntry);
contentType = guessContentTypeFromStream(
new BufferedInputStream(in));
in.close();
} catch (IOException e) {
// don't do anything
}
}
if (contentType == null) {
contentType = guessContentTypeFromName(entryName);
}
if (contentType == null) {
contentType = "content/unknown";
}
}
return contentType;
}
|
public boolean getDefaultUseCaches() {
return jarFileURLConnection.getDefaultUseCaches();
}
Returns the default value of a URLConnection's
useCaches flag.
Ths default is "sticky", being a part of the static state of all
URLConnections. This flag applies to the next, and all following
URLConnections that are created. |
public String getHeaderField(String name) {
return jarFileURLConnection.getHeaderField(name);
}
|
public InputStream getInputStream() throws IOException {
connect();
InputStream result = null;
if (entryName == null) {
throw new IOException("no entry name specified");
} else {
if (jarEntry == null) {
throw new FileNotFoundException("JAR entry " + entryName +
" not found in " +
jarFile.getName());
}
result = new JarURLInputStream (jarFile.getInputStream(jarEntry));
}
return result;
}
|
public JarEntry getJarEntry() throws IOException {
connect();
return jarEntry;
}
|
public JarFile getJarFile() throws IOException {
connect();
return jarFile;
}
|
public Permission getPermission() throws IOException {
return jarFileURLConnection.getPermission();
}
|
public Map getRequestProperties() {
return jarFileURLConnection.getRequestProperties();
}
Returns an unmodifiable Map of general request
properties for this connection. The Map keys
are Strings that represent the request-header
field names. Each Map value is a unmodifiable List
of Strings that represents the corresponding
field values. |
public String getRequestProperty(String key) {
return jarFileURLConnection.getRequestProperty(key);
}
Returns the value of the named general request property for this
connection. |
public boolean getUseCaches() {
return jarFileURLConnection.getUseCaches();
}
Returns the value of this URLConnection's
useCaches field. |
public void setAllowUserInteraction(boolean allowuserinteraction) {
jarFileURLConnection.setAllowUserInteraction(allowuserinteraction);
}
Set the value of the allowUserInteraction field of
this URLConnection. |
public void setDefaultUseCaches(boolean defaultusecaches) {
jarFileURLConnection.setDefaultUseCaches(defaultusecaches);
}
Sets the default value of the useCaches field to the
specified value. |
public void setIfModifiedSince(long ifmodifiedsince) {
jarFileURLConnection.setIfModifiedSince(ifmodifiedsince);
}
Sets the value of the ifModifiedSince field of
this URLConnection to the specified value. |
public void setRequestProperty(String key,
String value) {
jarFileURLConnection.setRequestProperty(key, value);
}
Sets the general request property. |
public void setUseCaches(boolean usecaches) {
jarFileURLConnection.setUseCaches(usecaches);
}
Sets the value of the useCaches field of this
URLConnection to the specified value.
Some protocols do caching of documents. Occasionally, it is important
to be able to "tunnel through" and ignore the caches (e.g., the
"reload" button in a browser). If the UseCaches flag on a connection
is true, the connection is allowed to use whatever caches it can.
If false, caches are to be ignored.
The default value comes from DefaultUseCaches, which defaults to
true. |