KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > help > internal > protocols > HelpURLStreamHandler


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.help.internal.protocols;
12 import java.io.*;
13 import java.net.*;
14 public class HelpURLStreamHandler extends URLStreamHandler {
15     private static HelpURLStreamHandler instance;
16     /**
17      * Constructor for URLHandler
18      */

19     public HelpURLStreamHandler() {
20         super();
21     }
22     /**
23      * @see java.net.URLStreamHandler#openConnection(java.net.URL)
24      */

25     protected URLConnection openConnection(URL url) throws IOException {
26         String JavaDoc protocol = url.getProtocol();
27         if (protocol.equals("help")) { //$NON-NLS-1$
28
return new HelpURLConnection(url);
29         }
30         return null;
31     }
32     public static URLStreamHandler getDefault() {
33         if (instance == null) {
34             instance = new HelpURLStreamHandler();
35         }
36         return instance;
37     }
38 }
39
Popular Tags