From 386230f050d689cd691cf1b78920c98e131ca4e7 Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Wed, 21 Aug 2002 05:34:45 +0000 Subject: Authenticator.java: updated JDK 1.4 2003-08-21 Michael Koch * java/net/Authenticator.java: updated JDK 1.4 * java/net/ContentHandler.java: updated JDK 1.4 From-SVN: r56481 --- libjava/java/net/ContentHandler.java | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'libjava/java/net/ContentHandler.java') diff --git a/libjava/java/net/ContentHandler.java b/libjava/java/net/ContentHandler.java index 9b88d6b..ce8d7ee 100644 --- a/libjava/java/net/ContentHandler.java +++ b/libjava/java/net/ContentHandler.java @@ -88,4 +88,36 @@ public ContentHandler() { } */ public abstract Object getContent(URLConnection urlc) throws 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. If the object doesnt match any type in + * classes it returns null. + * + * @param urlc A URLConnection object to read data from. + * + * @return An object representing the data read + * + * @exception IOException If an error occurs + * + * @since 1.3 + */ +public Object getContent(URLConnection urlc, Class[] classes) + throws IOException +{ + Object obj = getContent (urlc); + + for (int i = 0; i < classes.length; i++) + { + if (classes [i].isInstance (obj)) + return obj; + } + + return null; +} + } // class ContentHandler -- cgit v1.1