Abstract Interface URLStreamHandlerFactory in Java

digitization, transformation, binary

Abstract Interface URLStreamHandlerFactory in Java

This abstract interface defines a method that creates a URLStreamHandler object for a specified protocol. The interface is implemented by classes that select URLStreamHandler subclasses to process particular protocol types.

The URL class uses a URLStreamHandlerFactory to create URLStreamHandler objects. The protocol type is determined by the portion of the URL up to the first colon. For example, given the following URL:

Ads code goes here

http://www.techtravelhub.com/test.html

the protocol type is Http. A URLStreamHandlerFactory that recognizes Http returns a URLStreamHandler that can process the URL.

Normal applications never need to use or implement this interface.

The structure of the abstract interface URLStreamHandlerFactory is given by

public abstract interface java.net.URLStreamHandlerFactory{
// Public Instance Methods
public abstract URLStreamHandler createURLStreamHandler(String protocol);
}
public abstract URLStreamHandler createURLStreamHandler (String protocol)

public abstract URLStreamHandler createURLStreamHandler (String protocol) method creates an object of the appropriate subclass of URLStreamHandler that can process a URL using the named protocol.
Parameters
protocol – A String that represents a protocol.

Share and Enjoy !

READ  Class MuiticastSocket in Java

Leave a Comment

Your email address will not be published. Required fields are marked *