org.openide.execution
Class NbfsStreamHandlerFactory

java.lang.Object
  |
  +--org.openide.execution.NbfsStreamHandlerFactory
All Implemented Interfaces:
URLStreamHandlerFactory

public class NbfsStreamHandlerFactory
extends Object
implements URLStreamHandlerFactory

Handle custom URL protocols. This class is registered by Repository as the default stream handler factory for the VM. It comes with several useful URL protocols, for accessing IDE-internal resources. You may also add your own.


Constructor Summary
NbfsStreamHandlerFactory()
          Create a factory, and preregister several useful protocols.
 
Method Summary
 URLStreamHandler createURLStreamHandler(String protocol)
          Create a new URL stream handler.
 void deregister(String protocol)
          Deregister a stream handler.
static NbfsStreamHandlerFactory getDefault()
          Get the default factory instance.
 void register(String protocol, URLStreamHandler handler)
          Register a new stream handler into this factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NbfsStreamHandlerFactory

public NbfsStreamHandlerFactory()
Create a factory, and preregister several useful protocols. These include:
nbfs
Locates a particular file on a particular filesystem. Create such a URL using NbfsURLConnection.encodeFileObject(org.openide.filesystems.FileObject).
nbres
A resource as loaded by the system (module) classloader. After the protocol and colon, a resource path beginning with a slash.
nbrescurr
As above, but using the current classloader which will also search filesystems.
nbresloc
A resource from the system classloader; but will also look for localized variants. Such variants will have the same package and extension, but the basename may be suffixed with a locale suffix according to the normal search order and default locale.
nbrescurrloc
As above, but using the current classloader.
nbresboot
Uses startup classloader (system classpath, no modules).
nbresbootloc
Startup classloader and localized.
See Also:
NbfsURLConnection, TopManager.systemClassLoader(), TopManager.currentClassLoader(), NbBundle.getLocalizedFile(String,String,Locale,ClassLoader)
Method Detail

getDefault

public static NbfsStreamHandlerFactory getDefault()
Get the default factory instance.
Returns:
the default instance

register

public void register(String protocol,
                     URLStreamHandler handler)
              throws SecurityException
Register a new stream handler into this factory.
Parameters:
protocol - the protocol it will recognize
handler - the handler to register
Throws:
SecurityException - if the protocol is already registered

deregister

public void deregister(String protocol)
                throws SecurityException
Deregister a stream handler.
Parameters:
protocol - the protocol to deregister
Throws:
SecurityException - if you did not originally register this protocol

createURLStreamHandler

public URLStreamHandler createURLStreamHandler(String protocol)
Create a new URL stream handler.
Specified by:
createURLStreamHandler in interface URLStreamHandlerFactory
Parameters:
protocol - the URL protocol. This should have already been registered.
Returns:
a stream handler if a registered protocol was specified, null otherwise


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.