2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / libjava / java / net / URI.java
blob34d212f99e4639c73114c9816b4de9d070b20536
1 /* URI.java - An URI class
2 Copyright (C) 2002 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
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.
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.
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.
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.
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. */
38 package java.net;
40 import java.io.IOException;
41 import java.io.ObjectInputStream;
42 import java.io.ObjectOutputStream;
43 import java.io.Serializable;
45 /**
46 * @author Michael Koch <konqueror@gmx.de>
47 * @since 1.4
49 public final class URI
50 implements Comparable, Serializable
52 static final long serialVersionUID = -6052424284110960213L;
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;
65 private void readObject (ObjectInputStream is)
66 throws ClassNotFoundException, IOException
70 private void writeObject (ObjectOutputStream is)
71 throws IOException
75 private void parseURI (String str)
76 throws URISyntaxException
80 /**
81 * Creates an URI from the given string
83 * @param str The string to create the URI from
85 * @exception URISyntaxException If the given string violates RFC 2396
86 * @exception NullPointerException If str is null
88 public URI (String str)
89 throws URISyntaxException
93 /**
94 * Create an URI from the given components
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
104 * @exception URISyntaxException If the given string violates RFC 2396
106 public URI (String scheme, String userInfo, String host, int port,
107 String path, String query, String fragment)
108 throws URISyntaxException
113 * Create an URI from the given components
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
121 * @exception URISyntaxException If the given string violates RFC 2396
123 public URI (String scheme, String authority, String path, String query,
124 String fragment)
125 throws URISyntaxException
130 * Create an URI from the given components
132 * @param scheme The scheme name
133 * @param host The hostname
134 * @param path The path
135 * @param fragment The fragment
137 * @exception URISyntaxException If the given string violates RFC 2396
139 public URI (String scheme, String host, String path, String fragment)
140 throws URISyntaxException
145 * Create an URI from the given components
147 * @param scheme The scheme name
148 * @param ssp The scheme specific part
149 * @param fragment The fragment
151 * @exception URISyntaxException If the given string violates RFC 2396
153 public URI (String scheme, String ssp, String fragment)
154 throws URISyntaxException
159 * Create an URI from the given string
161 * @param str The string to create the URI from
163 * @exception IllegalArgumentException If the given string violates RFC 2396
164 * @exception NullPointerException If str is null
166 public static URI create (String str)
168 return null;
172 * Attempts to parse this URI's authority component, if defined,
173 * into user-information, host, and port components
175 * @exception URISyntaxException If the given string violates RFC 2396
177 public URI parseServerAuthority ()
178 throws URISyntaxException
180 return null;
184 * Returns a normalizes versions of the URI
186 public URI normalize ()
188 return null;
192 * Resolves the given URI against this URI
194 * @param uri The URI to resolve against this URI
196 * @return The resulting URI
198 * @exception NullPointerException If uri is null
200 public URI resolve (URI uri)
202 return null;
206 * Resolves the given URI string against this URI
208 * @param str The URI as string to resolve against this URI
210 * @return The resulting URI
212 * @exception IllegalArgumentException If the given URI string
213 * violates RFC 2396
214 * @exception NullPointerException If uri is null
216 public URI resolve (String str)
217 throws IllegalArgumentException
219 return null;
223 * Relativizes the given URI against this URI
225 * @param uri The URI to relativize this URI
227 * @return The resulting URI
229 * @exception NullPointerException If uri is null
231 public URI relativize (URI uri)
233 return null;
237 * Creates an URL from an URI
239 * @exception MalformedURLException If a protocol handler for the URL could
240 * not be found, or if some other error occurred while constructing the URL
241 * @exception IllegalArgumentException If the URI is not absolute
243 public URL toURL ()
244 throws IllegalArgumentException, MalformedURLException
246 return null;
250 * Returns the scheme of the URI
252 public String getScheme ()
254 return scheme;
258 * Tells whether this URI is absolute or not
260 public boolean isAbsolute ()
262 return false;
266 * Tell whether this URI is opaque or not
268 public boolean isOpaque ()
270 return false;
274 * Returns the raw scheme specific part of this URI.
275 * The scheme-specific part is never undefined, though it may be empty
277 public String getRawSchemeSpecificPart ()
279 return null;
283 * Returns the decoded scheme specific part of this URI.
285 public String getSchemeSpecificPart ()
287 return null;
291 * Returns the rae authority part of this URI
293 public String getRawAuthority ()
295 return authority;
299 * Returns the decoded authority part of this URI
301 public String getAuthority ()
303 return null;
307 * Returns the raw user info part of this URI
309 public String getRawUserInfo ()
311 return userInfo;
315 * Returns the decoded user info part of this URI
317 public String getUserInfo ()
319 return null;
323 * Returns the hostname of the URI
325 public String getHost ()
327 return host;
331 * Returns the port number of the URI
333 public int getPort ()
335 return port;
339 * Returns the raw path part of this URI
341 public String getRawPath ()
343 return path;
347 * Returns the path of the URI
349 public String getPath ()
351 return null;
355 * Returns the raw query part of this URI
357 public String getRawQuery ()
359 return query;
363 * Returns the query of the URI
365 public String getQuery ()
367 return null;
371 * Return the raw fragment part of this URI
373 public String getRawFragment ()
375 return fragment;
379 * Returns the fragment of the URI
381 public String getFragment ()
383 return null;
387 * Compares the URI with a given object
389 * @param obj The obj to compare the URI with
391 public boolean equals(Object obj)
393 return false;
397 * Computes the hascode of the URI
399 public int hashCode ()
401 return 0;
405 * Compare the URI with another object that must be an URI too
407 * @param obj This object to compare this URI with
409 * @exception ClassCastException If given object ist not an URI
411 public int compareTo (Object obj)
412 throws ClassCastException
414 return 0;
418 * Returns the URI as string
420 public String toString ()
422 return "";
426 * Returns the URI as US-ASCII string
428 public String toASCIIString ()
430 return "";