java.net
public abstract class ContentHandler extends Object
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 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. |
Object | getContent(URLConnection urlc, 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. |
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: urlc A URLConnection
object to read data from.
Returns: An object representing the data read
Throws: IOException If an error occurs
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.
Parameters: urlc A URLConnection
object to read data from. classes An array of types of objects that are candidate types
for the data to be read.
Returns: An object representing the data read, or null
if the data does not match any of the candidate types.
Throws: IOException If an error occurs
Since: 1.3