public abstract class ContentHandler extends Object
ContentHandler
是所有类读取一个
URLConnection
一
Object
父类。
应用程序通常不直接调用这个类中的getContent
方法。相反,一个应用程序调用类URL
或URLConnection
的getContent
方法。应用程序的内容处理程序工厂(一个类实现通过调用setContentHandler
设置界面ContentHandlerFactory
实例)被称为一个String
给人套接字上接收对象的MIME类型。工厂的ContentHandler
返回子类的一个实例,它的getContent
方法来创建对象。
如果没有内容处理程序可以发现,URLConnection将寻找在一个用户自定义设置的地方内容处理程序。默认情况下,它看起来在sun.net.www.content,但用户可以定义竖线分隔组类前缀搜索另外通过定义java.content.handler.pkgs财产。类名称必须是窗体的:
{包前缀}。{主要}。{小}例如yoyodyne.experimental.text.plain如果内容处理程序类加载会由一个类加载器是调用者的委托链外进行,JVM需要RuntimePermission”中getClassLoader方法”。
Constructor and Description |
---|
ContentHandler() |
Modifier and Type | Method and Description |
---|---|
abstract Object |
getContent(URLConnection urlc)
给定一个位于对象表示的开头的一个网址连接流,该方法读取该流,并从它创建一个对象。
|
Object |
getContent(URLConnection urlc, 类[] classes)
给定一个位于对象表示的开头的一个网址连接流,该方法读取该流,并创建一个与指定的类型的一个匹配的对象。
|
public abstract Object getContent(URLConnection urlc) throws IOException
urlc
-一个URL连接。
ContentHandler
读。
IOException
-如果在阅读对象发生I/O错误。
public Object getContent(URLConnection urlc, 类[] classes) throws IOException
urlc
-一个URL连接。
classes
-类型的数组要求
ContentHandler
是建议类型的第一场比赛。如果没有所请求的支持,则为空。
IOException
-如果在阅读对象发生I/O错误。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.