public class URLDataSource extends Object implements DataSource
URL接口中包装URL对象的对象。
URLDataSource简化了JavaBeans激活框架内由URL描述的数据的处理,因为此类可用于创建新的DataHandler。
注意:DataHandler对象使用URL构造时,内部将创建一个URLDataSource。
DataSource , DataHandler
| Constructor and Description |
|---|
URLDataSource(URL url)
URLDataSource构造函数。
|
| Modifier and Type | Method and Description |
|---|---|
String |
getContentType()
返回URL内容类型头字段的值。
|
InputStream |
getInputStream()
来自URL的getInputStream方法。
|
String |
getName()
在用于实例化对象的URL上调用
getFile方法。
|
OutputStream |
getOutputStream()
来自URL的getOutputStream方法。
|
URL |
getURL()
返回用于创建此DataSource的URL。
|
public URLDataSource(URL url)
url - 要封装在此对象中的URL。
public String getContentType()
URLConnection.getContentType方法。
注意:此方法尝试在URL上调用openConnection方法。
如果此方法失败,或者如果内容类型未从URLConnection返回,则getContentType返回“application / octet-stream”作为内容类型。
getContentType在界面
DataSource
public String getName()
getFile方法。
getName在界面
DataSource
public InputStream getInputStream() throws IOException
openStream方法。
getInputStream在界面
DataSource
IOException
public OutputStream getOutputStream() throws IOException
getOutputStream在界面
DataSource
IOException
public URL getURL()
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.