|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
javax.activation Class URLDataSource
java.lang.Object javax.activation.URLDataSource
- All Implemented Interfaces:
- DataSource
public class URLDataSource
- extends Object
- implements DataSource
Implements:
DataSource
URLDataSource 类提供一个对象,此对象将
URL
对象包装在 DataSource 接口中。URLDataSource 简化了 JavaBeans Activation Framework 中 URL 描述的数据处理方法,因为此类可用于创建新的 DataHandler。注:当用 URL 构造 DataHandler 对象时,DataHandler 对象在内部创建一个 URLDataSource。
See also | javax.activation.DataSource, javax.activation.DataHandler |
The URLDataSource class provides an object that wraps a URL
object in a DataSource interface. URLDataSource simplifies the handling
of data described by URLs within the JavaBeans Activation Framework
because this class can be used to create new DataHandlers. NOTE: The
DataHandler object creates a URLDataSource internally,
when it is constructed with a URL.
- See Also:
DataSource
,DataHandler
Constructor Summary | |
---|---|
URLDataSource(URL url)
URLDataSource constructor. |
Method Summary | |
---|---|
String |
getContentType()
Returns the value of the URL content-type header field. |
InputStream |
getInputStream()
The getInputStream method from the URL. |
String |
getName()
Calls the getFile method on the URL used to
instantiate the object. |
OutputStream |
getOutputStream()
The getOutputStream method from the URL. |
URL |
getURL()
Return the URL used to create this DataSource. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public
URLDataSource(java.net.URL url)
URLDataSource 构造方法。在调用了要求打开到 URL 连接的方法之前,URLDataSource 类不会这样做。
url | 要封装在此对象中的 URL。 |
URLDataSource
public URLDataSource(URL url)
- URLDataSource constructor. The URLDataSource class will
not open a connection to the URL until a method requiring it
to do so is called.
- Parameters:
url
- The URL to be encapsulated in this object.
Method Detail |
---|
public String
getContentType()
返回 URL 内容-类型 (content-type) 头字段的值。获取 URLConnection 对象后,它调用 URL 的 URLConnection.getContentType
方法。注:此方法尝试调用 URL 的 openConnection
方法。如果此方法失败,或内容类型不是从 URLConnection 返回的,则 getContentType 返回 "application/octet-stream" 作为内容类型。
return | 内容类型。 |
getContentType
public String getContentType()
- Returns the value of the URL content-type header field.
It calls the URL's
URLConnection.getContentType
method after retrieving a URLConnection object. Note: this method attempts to call theopenConnection
method on the URL. If this method fails, or if a content type is not returned from the URLConnection, getContentType returns "application/octet-stream" as the content type. - Specified by:
getContentType
in interfaceDataSource
- Returns:
- the content type.
public String
getName()
调用用于实例化对象的 URL 的 getFile
方法。
return | 调用 URL 的 getFile 方法的结果。 |
getName
public String getName()
- Calls the
getFile
method on the URL used to instantiate the object. - Specified by:
getName
in interfaceDataSource
- Returns:
- the result of calling the URL's getFile method.
public java.io.InputStream
getInputStream() throws java.io.IOException
URL 的 getInputStream 方法。调用 URL 的 openStream
方法。
return | InputStream。 |
getInputStream
public InputStream getInputStream() throws IOException
- The getInputStream method from the URL. Calls the
openStream
method on the URL. - Specified by:
getInputStream
in interfaceDataSource
- Returns:
- the InputStream.
- Throws:
IOException
public java.io.OutputStream
getOutputStream() throws java.io.IOException
URL 的 getOutputStream 方法。首先,尝试为 URL 获取 URLConnection 对象。如果成功,则返回 URLConnection 的 getOutputStream 方法。
return | OutputStream。 |
getOutputStream
public OutputStream getOutputStream() throws IOException
- The getOutputStream method from the URL. First an attempt is
made to get the URLConnection object for the URL. If that
succeeds, the getOutputStream method on the URLConnection
is returned.
- Specified by:
getOutputStream
in interfaceDataSource
- Returns:
- the OutputStream.
- Throws:
IOException
public java.net.URL
getURL()
返回用于创建此 DataSource 的 URL。
return | URL。 |
getURL
public URL getURL()
- Return the URL used to create this DataSource.
- Returns:
- The URL.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Submit a bug or feature
Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!