All About Class URLStreamHandler in Java



The abstract class URLStreamHandler is the common super class for all stream protocol handlers.A stream protocol handler knows how to make a connection for a particular protocol type such as ftp,http,gopher etc.

The class structure of URLStreamHandler is given as:

public abstract class java.net.URLStreamHandler extends java.lang.Object{
//constructor
public URLStreamHandler();
//default constructor
//methods
protected abstract URLConnection OpenConnection(URL url);
//opens a connection to the object referenced by the URL argument.it returns an URLConnection object
//for the URL.it throws IOException if an I/O error occurs while opening the connection.
protected void parseURL(URL url,String spec,int start,int limit);
//parses the string representation of a URL into an URL object.Limit-the character position to stop 
//parsing at.This is the end of th string or the position of the # character if present.
protected void setURL(URL url,String protocol,String host,int port,String file,String ref);
//sets the fileds of the URL argument to the indicated value.
protected String toExternalForm(URL url);
//converts a URL of a specific protocol to a String.
}
 
All About Class URLStreamHandler in Java All About Class URLStreamHandler in Java Reviewed by Animesh Chatterjee on October 12, 2018 Rating: 5

No comments:

Powered by Blogger.