FileDocCategorySizeDatePackage
ContentHandler.javaAPI DocAndroid 1.5 API2644Wed May 06 22:41:04 BST 2009java.net

ContentHandler

public abstract class ContentHandler extends Object
This class converts the content of a certain format (i.e. a MIME type) into a Java type object. It is created by {@code ContentHandlerFactory}. The data values should be accessed via {@code URL} or {@code URLConnection}.
see
ContentHandlerFactory
see
URL#getContent()
see
URLConnection#getContent()
since
Android 1.0

Fields Summary
Constructors Summary
Methods Summary
public abstract java.lang.ObjectgetContent(java.net.URLConnection uConn)
Returns the object pointed by the specified URL connection {@code uConn}.

param
uConn URL connection that points to the desired object.
return
object referred by {@code uConn}.
throws
IOException if an IO error occurs during the retrieval of the object
since
Android 1.0

public java.lang.ObjectgetContent(java.net.URLConnection uConn, java.lang.Class[] types)
Returns the object pointed by the specified URL connection {@code uConn}.

param
uConn URL connection that points to the desired object.
param
types list of acceptable content types.
return
resource object pointed by this URL or {@code null} if the content doesn't match one of the specified content types.
throws
IOException if an error occurred while obtaining the content.
since
Android 1.0

        Object content = getContent(uConn);
        for (int i = 0; i < types.length; i++) {
            if (types[i].isInstance(content)) {
                return content;
            }
        }
        return null;