Abstract Interface ContentHandlerFactory in Java

Class Class in Java

Abstract Interface ContentHandlerFactory in Java

ContentHandlerFactory interface defines a method that creates and returns an appropriate ContentHandler object for a specified MIME type. A system-wide ContentHandlerFactory interface may be specified by using the URLConnection. setContentHandlerFactory() method. Normal applications never need to use or implement this interface.

The URLStreamHandler class uses a ContentHandlerFactory to create ContentHandler objects. The content type is usually implied by the portion of the URL following the last period.

Ads code goes here

The MIME content-type is text/html. A ContentHandlerFactory that recognizes text/html returns a ContentHandler object that can process that kind of content.

The abstract interface structure of ContentHandlerFactory in Java is given as

public abstract interface java.net.ContentHandlerFactory{
// Public Instance Methods
public abstract ContentHandler createContentHandler(String mimetype);
}

The details of the class structure are given as follows:

public abstract ContentHandler createContentHandler(String mimetype);

public abstract ContentHandler createContentHandler(String mimetype) method creates an object of the appropriate subclass of ContentHandler that can read and process data for the given MIME type.

This method returns a ContentHandler object that can read the specified type of content.

Parameter
mimetype – A String that represents a MIME type.

Share and Enjoy !

READ  Abstract Class Collator in Java

Leave a Comment

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