Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.net
Class ContentHandler  view ContentHandler download ContentHandler.java

java.lang.Object
  extended byjava.net.ContentHandler

public abstract class ContentHandler
extends java.lang.Object

This is an abstract class that is the superclass for classes that read objects from URL's. Calling the getContent() method in the URL class or the URLConnection class will cause an instance of a subclass of ContentHandler to be created for the MIME type of the object being downloaded from the URL. Thus, this class is seldom needed by applications/applets directly, but only indirectly through methods in other classes.


Constructor Summary
ContentHandler()
          Default, no-argument constructor.
 
Method Summary
abstract  java.lang.Object getContent(URLConnection urlc)
          This method reads from the InputStream of the passed in URL connection and uses the data downloaded to create an Object represening the content.
 java.lang.Object getContent(URLConnection urlc, java.lang.Class[] classes)
          This method reads from the InputStream of the passed in URL connection and uses the data downloaded to create an Object represening the content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentHandler

public ContentHandler()
Default, no-argument constructor.

Method Detail

getContent

public abstract java.lang.Object getContent(URLConnection urlc)
                                     throws java.io.IOException
This method reads from the InputStream of the passed in URL connection and uses the data downloaded to create an Object represening the content. For example, if the URL is pointing to a GIF file, this method might return an Image object. This method must be implemented by subclasses.


getContent

public java.lang.Object getContent(URLConnection urlc,
                                   java.lang.Class[] classes)
                            throws java.io.IOException
This method reads from the InputStream of the passed in URL connection and uses the data downloaded to create an Object represening the content. For example, if the URL is pointing to a GIF file, this method might return an Image object. This method must be implemented by subclasses. This method uses the list of supplied classes as candidate types. If the data read doesn't match any of the supplied type, null is returned.

Since:
1.3