source: trunk/src/gcc/libjava/java/net/URLStreamHandler.java@ 228

Last change on this file since 228 was 2, checked in by bird, 23 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 5.2 KB
Line 
1// URLStreamHandler.java - Superclass of all stream protocol handlers.
2
3/* Copyright (C) 1999, 2002 Free Software Foundation
4
5 This file is part of libgcj.
6
7This software is copyrighted work licensed under the terms of the
8Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9details. */
10
11package java.net;
12
13/**
14 * @author Warren Levy <[email protected]>
15 * @date March 4, 1999.
16 */
17
18/**
19 * Written using on-line Java Platform 1.2 API Specification, as well
20 * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
21 * Status: Believed complete and correct.
22 */
23
24public abstract class URLStreamHandler
25{
26 protected abstract URLConnection openConnection(URL u)
27 throws java.io.IOException;
28
29 protected void parseURL(URL u, String spec, int start, int limit)
30 {
31 String host = u.getHost();
32 int port = u.getPort();
33 String file = u.getFile();
34
35 /* TBD: The JDK 1.2 doc specifically says that limit is the position
36 * to stop parsing at and that it will be either the end of the string
37 * or the position of '#'; thus the doc infers that this method does
38 * not set the ref.
39 */
40 if (spec.regionMatches (start, "//", 0, 2))
41 {
42 int hostEnd;
43 int colon;
44
45 start += 2;
46 int slash = spec.indexOf('/', start);
47 if (slash >= 0)