org.foray.common.url
Class FOrayURLStreamHandlerFactory

java.lang.Object
  extended by org.foray.common.url.FOrayURLStreamHandlerFactory
All Implemented Interfaces:
URLStreamHandlerFactory

public final class FOrayURLStreamHandlerFactory
extends Object
implements URLStreamHandlerFactory

URLStreamHandlerFactory implementation that allows custom protocols to be registered and accessed.


Method Summary
 URLStreamHandler createURLStreamHandler(String protocol)
           
static FOrayURLStreamHandlerFactory getURLStreamHandlerFactory()
          Provides access to a custom URLStreamHandlerFactory instance, creating it and registering it with Java if needed.
 void registerProtocol(String protocol, URLStreamHandler handler)
          Registers a new URLStreamHandler for use with a protocol.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createURLStreamHandler

public URLStreamHandler createURLStreamHandler(String protocol)
Specified by:
createURLStreamHandler in interface URLStreamHandlerFactory

registerProtocol

public void registerProtocol(String protocol,
                             URLStreamHandler handler)
Registers a new URLStreamHandler for use with a protocol.

Parameters:
protocol - The protocol to be registered. The registration will fail silently if this parameter is null.
handler - The URLStreamHandler instance which should be used for URLs whose protocol is protocol. The registration will fail silently if this parameter is null.

getURLStreamHandlerFactory

public static FOrayURLStreamHandlerFactory getURLStreamHandlerFactory()
Provides access to a custom URLStreamHandlerFactory instance, creating it and registering it with Java if needed.

Returns:
The custom URLStreamHandlerFactory instance for this session.


Copyright © 2017. All rights reserved.