< prev index next >

src/java.base/share/classes/java/net/URLStreamHandler.java

Print this page




  59      * exists a public, specialized URLConnection subclass belonging
  60      * to one of the following packages or one of their subpackages:
  61      * java.lang, java.io, java.util, java.net, the connection
  62      * returned will be of that subclass. For example, for HTTP an
  63      * HttpURLConnection will be returned, and for JAR a
  64      * JarURLConnection will be returned.
  65      *
  66      * @param      u   the URL that this connects to.
  67      * @return     a {@code URLConnection} object for the {@code URL}.
  68      * @exception  IOException  if an I/O error occurs while opening the
  69      *               connection.
  70      */
  71     protected abstract URLConnection openConnection(URL u) throws IOException;
  72 
  73     /**
  74      * Same as openConnection(URL), except that the connection will be
  75      * made through the specified proxy; Protocol handlers that do not
  76      * support proxying will ignore the proxy parameter and make a
  77      * normal connection.
  78      *
  79      * <p> Calling this method preempts the system's default
  80      * {@link java.net.ProxySelector ProxySelector} settings.
  81      *
  82      * @implSpec
  83      * The default implementation of this method first checks that the given
  84      * {code URL} and {code Proxy} are not null, then throws {@code
  85      * UnsupportedOperationException}. Subclasses should override this method
  86      * with an appropriate implementation.
  87      *
  88      * @param      u   the URL that this connects to.
  89      * @param      p   the proxy through which the connection will be made.
  90      *                 If direct connection is desired, Proxy.NO_PROXY
  91      *                 should be specified.
  92      * @return     a {@code URLConnection} object for the {@code URL}.
  93      * @exception  IOException  if an I/O error occurs while opening the
  94      *               connection.
  95      * @exception  IllegalArgumentException if either u or p is null,
  96      *               or p has the wrong type.
  97      * @exception  UnsupportedOperationException if the subclass that
  98      *               implements the protocol doesn't support this method.
  99      * @since      1.5
 100      */
 101     protected URLConnection openConnection(URL u, Proxy p) throws IOException {
 102         if (u == null || p == null)
 103             throw new IllegalArgumentException("null " + (u == null ? "url" : "proxy"));
 104         throw new UnsupportedOperationException("Method not implemented.");
 105     }
 106 
 107     /**
 108      * Parses the string representation of a {@code URL} into a
 109      * {@code URL} object.
 110      * <p>
 111      * If there is any inherited context, then it has already been
 112      * copied into the {@code URL} argument.
 113      * <p>
 114      * The {@code parseURL} method of {@code URLStreamHandler}
 115      * parses the string representation as if it were an
 116      * {@code http} specification. Most URL protocol families have a
 117      * similar parsing. A stream protocol handler for a protocol that has
 118      * a different syntax must override this routine.
 119      *
 120      * @param   u       the {@code URL} to receive the result of parsing
 121      *                  the spec.
 122      * @param   spec    the {@code String} representing the URL that
 123      *                  must be parsed.




  59      * exists a public, specialized URLConnection subclass belonging
  60      * to one of the following packages or one of their subpackages:
  61      * java.lang, java.io, java.util, java.net, the connection
  62      * returned will be of that subclass. For example, for HTTP an
  63      * HttpURLConnection will be returned, and for JAR a
  64      * JarURLConnection will be returned.
  65      *
  66      * @param      u   the URL that this connects to.
  67      * @return     a {@code URLConnection} object for the {@code URL}.
  68      * @exception  IOException  if an I/O error occurs while opening the
  69      *               connection.
  70      */
  71     protected abstract URLConnection openConnection(URL u) throws IOException;
  72 
  73     /**
  74      * Same as openConnection(URL), except that the connection will be
  75      * made through the specified proxy; Protocol handlers that do not
  76      * support proxying will ignore the proxy parameter and make a
  77      * normal connection.
  78      *
  79      * Calling this method preempts the system's default
  80      * {@link java.net.ProxySelector ProxySelector} settings.
  81      *






  82      * @param      u   the URL that this connects to.
  83      * @param      p   the proxy through which the connection will be made.
  84      *                 If direct connection is desired, Proxy.NO_PROXY
  85      *                 should be specified.
  86      * @return     a {@code URLConnection} object for the {@code URL}.
  87      * @exception  IOException  if an I/O error occurs while opening the
  88      *               connection.
  89      * @exception  IllegalArgumentException if either u or p is null,
  90      *               or p has the wrong type.
  91      * @exception  UnsupportedOperationException if the subclass that
  92      *               implements the protocol doesn't support this method.
  93      * @since      1.5
  94      */
  95     protected URLConnection openConnection(URL u, Proxy p) throws IOException {


  96         throw new UnsupportedOperationException("Method not implemented.");
  97     }
  98 
  99     /**
 100      * Parses the string representation of a {@code URL} into a
 101      * {@code URL} object.
 102      * <p>
 103      * If there is any inherited context, then it has already been
 104      * copied into the {@code URL} argument.
 105      * <p>
 106      * The {@code parseURL} method of {@code URLStreamHandler}
 107      * parses the string representation as if it were an
 108      * {@code http} specification. Most URL protocol families have a
 109      * similar parsing. A stream protocol handler for a protocol that has
 110      * a different syntax must override this routine.
 111      *
 112      * @param   u       the {@code URL} to receive the result of parsing
 113      *                  the spec.
 114      * @param   spec    the {@code String} representing the URL that
 115      *                  must be parsed.


< prev index next >