| 1 | /* URI.java - An URI class
|
|---|
| 2 | Copyright (C) 2002 Free Software Foundation, Inc.
|
|---|
| 3 |
|
|---|
| 4 | This file is part of GNU Classpath.
|
|---|
| 5 |
|
|---|
| 6 | GNU Classpath is free software; you can redistribute it and/or modify
|
|---|
| 7 | it under the terms of the GNU General Public License as published by
|
|---|
| 8 | the Free Software Foundation; either version 2, or (at your option)
|
|---|
| 9 | any later version.
|
|---|
| 10 |
|
|---|
| 11 | GNU Classpath is distributed in the hope that it will be useful, but
|
|---|
| 12 | WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 14 | General Public License for more details.
|
|---|
| 15 |
|
|---|
| 16 | You should have received a copy of the GNU General Public License
|
|---|
| 17 | along with GNU Classpath; see the file COPYING. If not, write to the
|
|---|
| 18 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|---|
| 19 | 02111-1307 USA.
|
|---|
| 20 |
|
|---|
| 21 | Linking this library statically or dynamically with other modules is
|
|---|
| 22 | making a combined work based on this library. Thus, the terms and
|
|---|
| 23 | conditions of the GNU General Public License cover the whole
|
|---|
| 24 | combination.
|
|---|
| 25 |
|
|---|
| 26 | As a special exception, the copyright holders of this library give you
|
|---|
| 27 | permission to link this library with independent modules to produce an
|
|---|
| 28 | executable, regardless of the license terms of these independent
|
|---|
| 29 | modules, and to copy and distribute the resulting executable under
|
|---|
| 30 | terms of your choice, provided that you also meet, for each linked
|
|---|
| 31 | independent module, the terms and conditions of the license of that
|
|---|
| 32 | module. An independent module is a module which is not derived from
|
|---|
| 33 | or based on this library. If you modify this library, you may extend
|
|---|
| 34 | this exception to your version of the library, but you are not
|
|---|
| 35 | obligated to do so. If you do not wish to do so, delete this
|
|---|
| 36 | exception statement from your version. */
|
|---|
| 37 |
|
|---|
| 38 | package java.net;
|
|---|
| 39 |
|
|---|
| 40 | import java.io.IOException;
|
|---|
| 41 | import java.io.ObjectInputStream;
|
|---|
| 42 | import java.io.ObjectOutputStream;
|
|---|
| 43 | import java.io.Serializable;
|
|---|
| 44 |
|
|---|
| 45 | /**
|
|---|
| 46 | * @author Michael Koch <[email protected]>
|
|---|
| 47 | * @since 1.4
|
|---|
| 48 | */
|
|---|
| 49 | public final class URI
|
|---|
| 50 | implements Comparable, Serializable
|
|---|
| 51 | {
|
|---|
| 52 | static final long serialVersionUID = -6052424284110960213L;
|
|---|
| 53 |
|
|---|
| 54 | String string;
|
|---|
| 55 | private String scheme;
|
|---|
| 56 | private String schemeSpecificPart;
|
|---|
| 57 | private String authority;
|
|---|
| 58 | private String userInfo;
|
|---|
| 59 | private String host;
|
|---|
| 60 | private int port;
|
|---|
| 61 | private String path;
|
|---|
| 62 | private String query;
|
|---|
| 63 | private String fragment;
|
|---|
| 64 |
|
|---|
| 65 | private void readObject (ObjectInputStream is)
|
|---|
| 66 | throws ClassNotFoundException, IOException
|
|---|
| 67 | {
|
|---|
| 68 | }
|
|---|
| 69 |
|
|---|
| 70 | private void writeObject (ObjectOutputStream is)
|
|---|
| 71 | throws IOException
|
|---|
| 72 | {
|
|---|
| 73 | }
|
|---|
| 74 |
|
|---|
| 75 | private void parseURI (String str)
|
|---|
| 76 | throws URISyntaxException
|
|---|
| 77 | {
|
|---|
| 78 | }
|
|---|
| 79 |
|
|---|
| 80 | /**
|
|---|
| 81 | * Creates an URI from the given string
|
|---|
| 82 | *
|
|---|
| 83 | * @param str The string to create the URI from
|
|---|
| 84 | *
|
|---|
| 85 | * @exception URISyntaxException If the given string violates RFC 2396
|
|---|
| 86 | * @exception NullPointerException If str is null
|
|---|
| 87 | */
|
|---|
| 88 | public URI (String str)
|
|---|
| 89 | throws URISyntaxException
|
|---|
| 90 | {
|
|---|
| 91 | }
|
|---|
| 92 |
|
|---|
| 93 | /**
|
|---|
| 94 | * Create an URI from the given components
|
|---|
| 95 | *
|
|---|
| 96 | * @param scheme The scheme name
|
|---|
| 97 | * @param userInfo The username and authorization info
|
|---|
| 98 | * @param host The hostname
|
|---|
| 99 | * @param port The port number
|
|---|
| 100 | * @param path The path
|
|---|
| 101 | * @param query The query
|
|---|
| 102 | * @param fragment The fragment
|
|---|
| 103 | *
|
|---|
| 104 | * @exception URISyntaxException If the given string violates RFC 2396
|
|---|
| 105 | */
|
|---|
| 106 | public URI (String scheme, String userInfo, String host, int port,
|
|---|
| 107 | String path, String query, String fragment)
|
|---|
| 108 | throws URISyntaxException
|
|---|
| 109 | {
|
|---|
| 110 | }
|
|---|
| 111 |
|
|---|
| 112 | /**
|
|---|
| 113 | * Create an URI from the given components
|
|---|
| 114 | *
|
|---|
| 115 | * @param scheme The scheme name
|
|---|
| 116 | * @param authority The authority
|
|---|
| 117 | * @param path The apth
|
|---|
| 118 | * @param query The query
|
|---|
| 119 | * @param fragment The fragmen
|
|---|
| 120 | *
|
|---|
| 121 | * @exception URISyntaxException If the given string violates RFC 2396
|
|---|
| 122 | */
|
|---|
| 123 | public URI (String scheme, String authority, String path, String query,
|
|---|
| 124 | String fragment)
|
|---|
| 125 | throws URISyntaxException
|
|---|
| 126 | {
|
|---|
| 127 | }
|
|---|
| 128 |
|
|---|
| 129 | /**
|
|---|
| 130 | * Create an URI from the given components
|
|---|
| 131 | *
|
|---|
| 132 | * @param scheme The scheme name
|
|---|
| 133 | * @param host The hostname
|
|---|
| 134 | * @param path The path
|
|---|
| 135 | * @param fragment The fragment
|
|---|
| 136 | *
|
|---|
| 137 | * @exception URISyntaxException If the given string violates RFC 2396
|
|---|
| 138 | */
|
|---|
| 139 | public URI (String scheme, String host, String path, String fragment)
|
|---|
| 140 | throws URISyntaxException
|
|---|
| 141 | {
|
|---|
| 142 | }
|
|---|
| 143 |
|
|---|
| 144 | /**
|
|---|
| 145 | * Create an URI from the given components
|
|---|
| 146 | *
|
|---|
| 147 | * @param scheme The scheme name
|
|---|
| 148 | * @param ssp The scheme specific part
|
|---|
| 149 | * @param fragment The fragment
|
|---|
| 150 | *
|
|---|
| 151 | * @exception URISyntaxException If the given string violates RFC 2396
|
|---|
| 152 | */
|
|---|
| 153 | public URI (String scheme, String ssp, String fragment)
|
|---|
| 154 | throws URISyntaxException
|
|---|
| 155 | {
|
|---|
| 156 | }
|
|---|
| 157 |
|
|---|
| 158 | /**
|
|---|
| 159 | * Create an URI from the given string
|
|---|
| 160 | *
|
|---|
| 161 | * @param str The string to create the URI from
|
|---|
| 162 | *
|
|---|
| 163 | * @exception IllegalArgumentException If the given string violates RFC 2396
|
|---|
| 164 | * @exception NullPointerException If str is null
|
|---|
| 165 | */
|
|---|
| 166 | public static URI create (String str)
|
|---|
| 167 | throws IllegalArgumentException, URISyntaxException
|
|---|
| 168 | {
|
|---|
| 169 | return null;
|
|---|
| 170 | }
|
|---|
| 171 |
|
|---|
| 172 | /**
|
|---|
| 173 | * Attempts to parse this URI's authority component, if defined,
|
|---|
| 174 | * into user-information, host, and port components
|
|---|
| 175 | *
|
|---|
| 176 | * @exception URISyntaxException If the given string violates RFC 2396
|
|---|
| 177 | */
|
|---|
| 178 | public URI parseServerAuthority ()
|
|---|
| 179 | throws URISyntaxException
|
|---|
| 180 | {
|
|---|
| 181 | return null;
|
|---|
| 182 | }
|
|---|
| 183 |
|
|---|
| 184 | /**
|
|---|
| 185 | * Returns a normalizes versions of the URI
|
|---|
| 186 | */
|
|---|
| 187 | public URI normalize ()
|
|---|
| 188 | {
|
|---|
| 189 | return null;
|
|---|
| 190 | }
|
|---|
| 191 |
|
|---|
| 192 | /**
|
|---|
| 193 | * Resolves the given URI against this URI
|
|---|
| 194 | *
|
|---|
| 195 | * @param uri The URI to resolve against this URI
|
|---|
| 196 | *
|
|---|
| 197 | * @return The resulting URI
|
|---|
| 198 | *
|
|---|
| 199 | * @exception NullPointerException If uri is null
|
|---|
| 200 | */
|
|---|
| 201 | public URI resolve (URI uri)
|
|---|
| 202 | {
|
|---|
| 203 | return null;
|
|---|
| 204 | }
|
|---|
| 205 |
|
|---|
| 206 | /**
|
|---|
| 207 | * Resolves the given URI string against this URI
|
|---|
| 208 | *
|
|---|
| 209 | * @param str The URI as string to resolve against this URI
|
|---|
| 210 | *
|
|---|
| 211 | * @return The resulting URI
|
|---|
| 212 | *
|
|---|
| 213 | * @exception IllegalArgumentException If the given URI string
|
|---|
| 214 | * violates RFC 2396
|
|---|
| 215 | * @exception NullPointerException If uri is null
|
|---|
| 216 | */
|
|---|
| 217 | public URI resolve (String str)
|
|---|
| 218 | throws IllegalArgumentException
|
|---|
| 219 | {
|
|---|
| 220 | return null;
|
|---|
| 221 | }
|
|---|
| 222 |
|
|---|
| 223 | /**
|
|---|
| 224 | * Relativizes the given URI against this URI
|
|---|
| 225 | *
|
|---|
| 226 | * @param uri The URI to relativize this URI
|
|---|
| 227 | *
|
|---|
| 228 | * @return The resulting URI
|
|---|
| 229 | *
|
|---|
| 230 | * @exception NullPointerException If uri is null
|
|---|
| 231 | */
|
|---|
| 232 | public URI relativize (URI uri)
|
|---|
| 233 | {
|
|---|
| 234 | return null;
|
|---|
| 235 | }
|
|---|
| 236 |
|
|---|
| 237 | /**
|
|---|
| 238 | * Creates an URL from an URI
|
|---|
| 239 | *
|
|---|
| 240 | * @exception MalformedURLException If a protocol handler for the URL could
|
|---|
| 241 | * not be found, or if some other error occurred while constructing the URL
|
|---|
| 242 | * @exception IllegalArgumentException If the URI is not absolute
|
|---|
| 243 | */
|
|---|
| 244 | public URL toURL ()
|
|---|
| 245 | throws IllegalArgumentException, MalformedURLException
|
|---|
| 246 | {
|
|---|
| 247 | return null;
|
|---|
| 248 | }
|
|---|
| 249 |
|
|---|
| 250 | /**
|
|---|
| 251 | * Returns the scheme of the URI
|
|---|
| 252 | */
|
|---|
| 253 | public String getScheme ()
|
|---|
| 254 | {
|
|---|
| 255 | return scheme;
|
|---|
| 256 | }
|
|---|
| 257 |
|
|---|
| 258 | /**
|
|---|
| 259 | * Tells whether this URI is absolute or not
|
|---|
| 260 | */
|
|---|
| 261 | public boolean isAbsolute ()
|
|---|
| 262 | {
|
|---|
| 263 | return false;
|
|---|
| 264 | }
|
|---|
| 265 |
|
|---|
| 266 | /**
|
|---|
| 267 | * Tell whether this URI is opaque or not
|
|---|
| 268 | */
|
|---|
| 269 | public boolean isOpaque ()
|
|---|
| 270 | {
|
|---|
| 271 | return false;
|
|---|
| 272 | }
|
|---|
| 273 |
|
|---|
| 274 | /**
|
|---|
| 275 | * Returns the raw scheme specific part of this URI.
|
|---|
| 276 | * The scheme-specific part is never undefined, though it may be empty
|
|---|
| 277 | */
|
|---|
| 278 | public String getRawSchemeSpecificPart ()
|
|---|
| 279 | {
|
|---|
| 280 | return null;
|
|---|
| 281 | }
|
|---|
| 282 |
|
|---|
| 283 | /**
|
|---|
| 284 | * Returns the decoded scheme specific part of this URI.
|
|---|
| 285 | */
|
|---|
| 286 | public String getSchemeSpecificPart ()
|
|---|
| 287 | {
|
|---|
| 288 | return null;
|
|---|
| 289 | }
|
|---|
| 290 |
|
|---|
| 291 | /**
|
|---|
| 292 | * Returns the rae authority part of this URI
|
|---|
| 293 | */
|
|---|
| 294 | public String getRawAuthority ()
|
|---|
| 295 | {
|
|---|
| 296 | return authority;
|
|---|
| 297 | }
|
|---|
| 298 |
|
|---|
| 299 | /**
|
|---|
| 300 | * Returns the decoded authority part of this URI
|
|---|
| 301 | */
|
|---|
| 302 | public String getAuthority ()
|
|---|
| 303 | {
|
|---|
| 304 | return null;
|
|---|
| 305 | }
|
|---|
| 306 |
|
|---|
| 307 | /**
|
|---|
| 308 | * Returns the raw user info part of this URI
|
|---|
| 309 | */
|
|---|
| 310 | public String getRawUserInfo ()
|
|---|
| 311 | {
|
|---|
| 312 | return userInfo;
|
|---|
| 313 | }
|
|---|
| 314 |
|
|---|
| 315 | /**
|
|---|
| 316 | * Returns the decoded user info part of this URI
|
|---|
| 317 | */
|
|---|
| 318 | public String getUserInfo ()
|
|---|
| 319 | {
|
|---|
| 320 | return null;
|
|---|
| 321 | }
|
|---|
| 322 |
|
|---|
| 323 | /**
|
|---|
| 324 | * Returns the hostname of the URI
|
|---|
| 325 | */
|
|---|
| 326 | public String getHost ()
|
|---|
| 327 | {
|
|---|
| 328 | return host;
|
|---|
| 329 | }
|
|---|
| 330 |
|
|---|
| 331 | /**
|
|---|
| 332 | * Returns the port number of the URI
|
|---|
| 333 | */
|
|---|
| 334 | public int getPort ()
|
|---|
| 335 | {
|
|---|
| 336 | return port;
|
|---|
| 337 | }
|
|---|
| 338 |
|
|---|
| 339 | /**
|
|---|
| 340 | * Returns the raw path part of this URI
|
|---|
| 341 | */
|
|---|
| 342 | public String getRawPath ()
|
|---|
| 343 | {
|
|---|
| 344 | return path;
|
|---|
| 345 | }
|
|---|
| 346 |
|
|---|
| 347 | /**
|
|---|
| 348 | * Returns the path of the URI
|
|---|
| 349 | */
|
|---|
| 350 | public String getPath ()
|
|---|
| 351 | {
|
|---|
| 352 | return null;
|
|---|
| 353 | }
|
|---|
| 354 |
|
|---|
| 355 | /**
|
|---|
| 356 | * Returns the raw query part of this URI
|
|---|
| 357 | */
|
|---|
| 358 | public String getRawQuery ()
|
|---|
| 359 | {
|
|---|
| 360 | return query;
|
|---|
| 361 | }
|
|---|
| 362 |
|
|---|
| 363 | /**
|
|---|
| 364 | * Returns the query of the URI
|
|---|
| 365 | */
|
|---|
| 366 | public String getQuery ()
|
|---|
| 367 | {
|
|---|
| 368 | return null;
|
|---|
| 369 | }
|
|---|
| 370 |
|
|---|
| 371 | /**
|
|---|
| 372 | * Return the raw fragment part of this URI
|
|---|
| 373 | */
|
|---|
| 374 | public String getRawFragment ()
|
|---|
| 375 | {
|
|---|
| 376 | return fragment;
|
|---|
| 377 | }
|
|---|
| 378 |
|
|---|
| 379 | /**
|
|---|
| 380 | * Returns the fragment of the URI
|
|---|
| 381 | */
|
|---|
| 382 | public String getFragment ()
|
|---|
| 383 | {
|
|---|
| 384 | return null;
|
|---|
| 385 | }
|
|---|
| 386 |
|
|---|
| 387 | /**
|
|---|
| 388 | * Compares the URI with a given object
|
|---|
| 389 | *
|
|---|
| 390 | * @param obj The obj to compare the URI with
|
|---|
| 391 | */
|
|---|
| 392 | public boolean equals(Object obj)
|
|---|
| 393 | {
|
|---|
| 394 | return false;
|
|---|
| 395 | }
|
|---|
| 396 |
|
|---|
| 397 | /**
|
|---|
| 398 | * Computes the hascode of the URI
|
|---|
| 399 | */
|
|---|
| 400 | public int hashCode ()
|
|---|
| 401 | {
|
|---|
| 402 | return 0;
|
|---|
| 403 | }
|
|---|
| 404 |
|
|---|
| 405 | /**
|
|---|
| 406 | * Compare the URI with another object that must be an URI too
|
|---|
| 407 | *
|
|---|
| 408 | * @param obj This object to compare this URI with
|
|---|
| 409 | *
|
|---|
| 410 | * @exception ClassCastException If given object ist not an URI
|
|---|
| 411 | */
|
|---|
| 412 | public int compareTo (Object obj)
|
|---|
| 413 | throws ClassCastException
|
|---|
| 414 | {
|
|---|
| 415 | return 0;
|
|---|
| 416 | }
|
|---|
| 417 |
|
|---|
| 418 | /**
|
|---|
| 419 | * Returns the URI as string
|
|---|
| 420 | */
|
|---|
| 421 | public String toString ()
|
|---|
| 422 | {
|
|---|
| 423 | return "";
|
|---|
| 424 | }
|
|---|
| 425 |
|
|---|
| 426 | /**
|
|---|
| 427 | * Returns the URI as US-ASCII string
|
|---|
| 428 | */
|
|---|
| 429 | public String toASCIIString ()
|
|---|
| 430 | {
|
|---|
| 431 | return "";
|
|---|
| 432 | }
|
|---|
| 433 | }
|
|---|