java.net.ContentHandler
java.lang.Object
None
None
JDK 1.0 or later
The ContentHandler class is an abstract class that defines a method to read data from a URLConnection and then create an Object appropriate for the type of content it has read. Each subclass of ContentHandler handles a specific type of content (i.e., MIME type).
You do not create ContentHandler objects directly; they are created by an object that implements the ContentHandlerFactory interface. A ContentHandlerFactory object selects and creates an appropriate ContentHandler for the content type. If you write your own ContentHandler subclasses, you should also write your own ContentHandlerFactory. The content handler factory for an application is set by a call to URLConnection.setContentHandlerFactory().
An application does not normally call the getContent() method of a ContentHandler directly; it should call URL.getContent() or URLConnection.getContent() instead.
A ContentHandler works in conjunction with a URLStreamHandler, but their roles do not overlap. The URLStreamHandler deals with the specifics of a protocol, such as negotiating with a server to retrieve a resource, while the ContentHandler expects a data stream from which it can construct an object.
public abstract class java.net.ContentHandler extends java.lang.Object { // Instance Methods public abstract Object getContent(URLConnection urlc) throws IOException; }
public abstract Object getContent(URLConnection urlc) throws IOException
A URLConnection that is the data source.
The Object created from the data source.
If any kind of I/O error occurs.
This method reads data from the given URLConnection and returns the object that is represented by the data.
Method |
Inherited From |
Method |
Inherited From |
---|---|---|---|
clone() |
Object |
equals(Object) |
Object |
finalize() |
Object |
getClass() |
Object |
int hashCode() |
Object |
notify() |
Object |
notifyAll() |
Object |
toString() |
Object |
wait() |
Object |
wait(long) |
Object |
wait(long, int) |
Object |
ContentHandlerFactory, IOException, URL, URLConnection, URLStreamHandler