/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @author Benjamin Renaud
* @since 1.2
*/
private static final boolean debug = false;
/* the Jar file factory. It handles both retrieval and caching.
*/
/* the url for the Jar file */
/* the permission to get this JAR file. This is the actual, ultimate,
* permission, returned by the jar file factory.
*/
/* the url connection for the JAR file */
/* the entry name, if any */
/* the JarEntry */
/* the jar file corresponding to this connection */
/* the content type for this connection */
throws MalformedURLException, IOException {
super(url);
jarFileURL = getJarFileURL();
entryName = getEntryName();
}
connect();
return jarFile;
}
connect();
return jarEntry;
}
return jarFileURLConnection.getPermission();
}
super (src);
}
try {
super.close();
} finally {
if (!getUseCaches()) {
}
}
}
}
if (!connected) {
/* the factory call will do the security checks */
/* we also ask the factory the permission that was required
* to get the jarFile, and set it as our permission.
*/
if (getUseCaches()) {
}
try {
if (!getUseCaches()) {
}
} catch (Exception e) {
}
" not found in " +
}
}
connected = true;
}
}
connect();
throw new IOException("no entry name specified");
} else {
" not found in " +
}
}
return result;
}
public int getContentLength() {
long result = getContentLengthLong();
return -1;
return (int) result;
}
public long getContentLengthLong() {
long result = -1;
try {
connect();
/* if the URL referes to an archive */
} else {
/* if the URL referes to an archive entry */
}
} catch (IOException e) {
}
return result;
}
connect();
} else {
result = super.getContent();
}
return result;
}
if (contentType == null) {
contentType = "x-java/jar";
} else {
try {
connect();
new BufferedInputStream(in));
} catch (IOException e) {
// don't do anything
}
}
if (contentType == null) {
}
if (contentType == null) {
contentType = "content/unknown";
}
}
return contentType;
}
}
/**
* Sets the general request property.
*
* @param key the keyword by which the request is known
* (e.g., "<code>accept</code>").
* @param value the value associated with it.
*/
}
/**
* Returns the value of the named general request property for this
* connection.
*
* @return the value of the named general request property for this
* connection.
*/
}
/**
* Adds a general request property specified by a
* key-value pair. This method will not overwrite
* existing values associated with the same key.
*
* @param key the keyword by which the request is known
* (e.g., "<code>accept</code>").
* @param value the value associated with it.
*/
}
/**
* 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.
*
* @return a Map of the general request properties for this connection.
*/
return jarFileURLConnection.getRequestProperties();
}
/**
* Set the value of the <code>allowUserInteraction</code> field of
* this <code>URLConnection</code>.
*
* @param allowuserinteraction the new value.
* @see java.net.URLConnection#allowUserInteraction
*/
}
/**
* Returns the value of the <code>allowUserInteraction</code> field for
* this object.
*
* @return the value of the <code>allowUserInteraction</code> field for
* this object.
* @see java.net.URLConnection#allowUserInteraction
*/
public boolean getAllowUserInteraction() {
return jarFileURLConnection.getAllowUserInteraction();
}
/*
* cache control
*/
/**
* Sets the value of the <code>useCaches</code> field of this
* <code>URLConnection</code> to the specified value.
* <p>
* 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.
*
* @see java.net.URLConnection#useCaches
*/
}
/**
* Returns the value of this <code>URLConnection</code>'s
* <code>useCaches</code> field.
*
* @return the value of this <code>URLConnection</code>'s
* <code>useCaches</code> field.
* @see java.net.URLConnection#useCaches
*/
public boolean getUseCaches() {
return jarFileURLConnection.getUseCaches();
}
/**
* Sets the value of the <code>ifModifiedSince</code> field of
* this <code>URLConnection</code> to the specified value.
*
* @param value the new value.
* @see java.net.URLConnection#ifModifiedSince
*/
}
/**
* Sets the default value of the <code>useCaches</code> field to the
* specified value.
*
* @param defaultusecaches the new value.
* @see java.net.URLConnection#useCaches
*/
}
/**
* Returns the default value of a <code>URLConnection</code>'s
* <code>useCaches</code> flag.
* <p>
* 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.
*
* @return the default value of a <code>URLConnection</code>'s
* <code>useCaches</code> flag.
* @see java.net.URLConnection#useCaches
*/
public boolean getDefaultUseCaches() {
return jarFileURLConnection.getDefaultUseCaches();
}
}