URLDataSource (Java EE 5 SDK)

Java

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


javax.activation Class URLDataSource

java.lang.Object
  extended by javax.activation.URLDataSource
所有已实现的接口:
DataSource

public class URLDataSource
extends Object
implements DataSource

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.

另请参见:
DataSource, DataHandler

构造器摘要
URLDataSource(URL url)
          URLDataSource constructor.
 
方法摘要
 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.
 
类方法继承 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造器详细信息

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.

参数:
url - The URL to be encapsulated in this object.

方法详细信息

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 the openConnection 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.

规范说明:
getContentType in interface DataSource
返回:
the content type.

getName

public String getName()
Calls the getFile method on the URL used to instantiate the object.

规范说明:
getName in interface DataSource
返回:
the result of calling the URL's getFile method.

getInputStream

public InputStream getInputStream()
                           throws IOException
The getInputStream method from the URL. Calls the openStream method on the URL.

规范说明:
getInputStream in interface DataSource
返回:
the InputStream.
抛出异常:
IOException

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.

规范说明:
getOutputStream in interface DataSource
返回:
the OutputStream.
抛出异常:
IOException

getURL

public URL getURL()
Return the URL used to create this DataSource.

返回:
The URL.

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


提交错误或意见

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.