java.net
Class ContentHandler
java.lang.Object
|
+--java.net.ContentHandler
public abstract class
ContentHandlerextends
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.
Authors:- Aaron M. Renn (arenn@urbanophile.com)
- Warren Levy <warrenl@cygnus.com>
ContentHandler
public ContentHandler()
Default, no-argument constructor.
getContent
public Object getContent(java.net.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. 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.
Parameters:
Returns:
- An object representing the data read
Throws:
getContent
public Object getContent(java.net.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. 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. If the object doesnt match any type in
classes it returns null.
Since:Parameters:
Returns:
- An object representing the data read
Throws:
getContent()
method in theURL
class or theURLConnection
class will cause an instance of a subclass ofContentHandler
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.