summaryrefslogtreecommitdiff
path: root/java/net/ContentHandler.java
diff options
context:
space:
mode:
authorMichael Koch <konqueror@gmx.de>2002-08-26 16:30:43 +0000
committerMichael Koch <konqueror@gmx.de>2002-08-26 16:30:43 +0000
commit8fc7fbdbc32283b86730a43a089943d728f05c17 (patch)
tree4f57c7cf994cf545bc750140bd61ccbd7bbb6f43 /java/net/ContentHandler.java
parentb1e258d090a3588091098015ece2c52470c98839 (diff)
downloadclasspath-8fc7fbdbc32283b86730a43a089943d728f05c17.tar.gz
2002-08-26 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java, java/net/ContentHandler.java: Merge with libgcj. Updated to JDK 1.4 compatibility.
Diffstat (limited to 'java/net/ContentHandler.java')
-rw-r--r--java/net/ContentHandler.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/java/net/ContentHandler.java b/java/net/ContentHandler.java
index 9b88d6b95..ce8d7ee8b 100644
--- a/java/net/ContentHandler.java
+++ b/java/net/ContentHandler.java
@@ -88,4 +88,36 @@ public ContentHandler() { }
*/
public abstract Object getContent(URLConnection urlc) throws IOException;
+/*************************************************************************/
+
+/**
+ * This method reads from the <code>InputStream</code> of the passed in URL
+ * connection and uses the data downloaded to create an <code>Object</code>
+ * represening the content. For example, if the URL is pointing to a GIF
+ * file, this method might return an <code>Image</code> object. This method
+ * must be implemented by subclasses. If the object doesnt match any type in
+ * classes it returns null.
+ *
+ * @param urlc A <code>URLConnection</code> 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