jdk/src/share/classes/java/net/JarURLConnection.java
changeset 19069 1d9cb0d080e3
parent 5506 202f599c92aa
child 21278 ef8a3a2a72f2
equal deleted inserted replaced
19068:f2358d18923a 19069:1d9cb0d080e3
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    43  * jar:<url>!/{entry}
    43  * jar:<url>!/{entry}
    44  * </pre>
    44  * </pre>
    45  *
    45  *
    46  * <p>for example:
    46  * <p>for example:
    47  *
    47  *
    48  * <p><code>
    48  * <p>{@code jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class}
    49  * jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class<br>
       
    50  * </code>
       
    51  *
    49  *
    52  * <p>Jar URLs should be used to refer to a JAR file or entries in
    50  * <p>Jar URLs should be used to refer to a JAR file or entries in
    53  * a JAR file. The example above is a JAR URL which refers to a JAR
    51  * a JAR file. The example above is a JAR URL which refers to a JAR
    54  * entry. If the entry name is omitted, the URL refers to the whole
    52  * entry. If the entry name is omitted, the URL refers to the whole
    55  * JAR file:
    53  * JAR file:
    56  *
    54  *
    57  * <code>
    55  * {@code jar:http://www.foo.com/bar/baz.jar!/}
    58  * jar:http://www.foo.com/bar/baz.jar!/
       
    59  * </code>
       
    60  *
    56  *
    61  * <p>Users should cast the generic URLConnection to a
    57  * <p>Users should cast the generic URLConnection to a
    62  * JarURLConnection when they know that the URL they created is a JAR
    58  * JarURLConnection when they know that the URL they created is a JAR
    63  * URL, and they need JAR-specific functionality. For example:
    59  * URL, and they need JAR-specific functionality. For example:
    64  *
    60  *
    74  * <p>Examples:
    70  * <p>Examples:
    75  *
    71  *
    76  * <dl>
    72  * <dl>
    77  *
    73  *
    78  * <dt>A Jar entry
    74  * <dt>A Jar entry
    79  * <dd><code>jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class</code>
    75  * <dd>{@code jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class}
    80  *
    76  *
    81  * <dt>A Jar file
    77  * <dt>A Jar file
    82  * <dd><code>jar:http://www.foo.com/bar/baz.jar!/</code>
    78  * <dd>{@code jar:http://www.foo.com/bar/baz.jar!/}
    83  *
    79  *
    84  * <dt>A Jar directory
    80  * <dt>A Jar directory
    85  * <dd><code>jar:http://www.foo.com/bar/baz.jar!/COM/foo/</code>
    81  * <dd>{@code jar:http://www.foo.com/bar/baz.jar!/COM/foo/}
    86  *
    82  *
    87  * </dl>
    83  * </dl>
    88  *
    84  *
    89  * <p><code>!/</code> is refered to as the <em>separator</em>.
    85  * <p>{@code !/} is refered to as the <em>separator</em>.
    90  *
    86  *
    91  * <p>When constructing a JAR url via <code>new URL(context, spec)</code>,
    87  * <p>When constructing a JAR url via {@code new URL(context, spec)},
    92  * the following rules apply:
    88  * the following rules apply:
    93  *
    89  *
    94  * <ul>
    90  * <ul>
    95  *
    91  *
    96  * <li>if there is no context URL and the specification passed to the
    92  * <li>if there is no context URL and the specification passed to the
   292      * Return the Certificate object for this connection if the URL
   288      * Return the Certificate object for this connection if the URL
   293      * for it points to a JAR file entry, null otherwise. This method
   289      * for it points to a JAR file entry, null otherwise. This method
   294      * can only be called once
   290      * can only be called once
   295      * the connection has been completely verified by reading
   291      * the connection has been completely verified by reading
   296      * from the input stream until the end of the stream has been
   292      * from the input stream until the end of the stream has been
   297      * reached. Otherwise, this method will return <code>null</code>
   293      * reached. Otherwise, this method will return {@code null}
   298      *
   294      *
   299      * @return the Certificate object for this connection if the URL
   295      * @return the Certificate object for this connection if the URL
   300      * for it points to a JAR file entry, null otherwise.
   296      * for it points to a JAR file entry, null otherwise.
   301      *
   297      *
   302      * @exception IOException if getting the JAR entry causes an
   298      * @exception IOException if getting the JAR entry causes an