All About Class ContentHandler in Java



ContentHandler is an abstract class and is the super class of all classes that read an Object from a URL connection. An application does not generally call the getContentHandler() method in this class directly.Instead,an application calls getContent() method in Class URL or in URLConnection.The application's content handler factory (an instance of a class that implements the interface ContentHandlerFactory) sets up by a call to setContentHandler and calls with a String giving the MIME type of the Object being received on the socket.The factory returns an instance of a subclass of ContentHandler and it's getContent() method is called to create the object.

The structure of the class ContentHandler is given as:

public abstract class java.net.ContentHandler extends java.lang.Object{
//constructors:
public ContentHandler();//The default constructor for ContentHandler class,creates an object of ContentHandler.
//Methods:
public abstract Object getContent(URLConnection conn);
//given an URL connect stream positioned at the beginning of the representation of an Object,this method reads 
//the stream and creates an Object from it. Returns the Object read by ContentHandler.It can throw IOException
//if an IO error occurs while reading the Object.
}
 
All About Class ContentHandler in Java All About Class ContentHandler in Java Reviewed by Animesh Chatterjee on October 08, 2018 Rating: 5

No comments:

Powered by Blogger.