public class URLDataSource extends Object implements DataSource
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
Constructor and Description |
---|
URLDataSource(URL url)
URLDataSource constructor.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public URLDataSource(URL url)
url
- The URL to be encapsulated in this object.public String getContentType()
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
public String getName()
getFile
method on the URL used to
instantiate the object.getName
in interface DataSource
public InputStream getInputStream() throws IOException
openStream
method on the URL.getInputStream
in interface DataSource
IOException
public OutputStream getOutputStream() throws IOException
getOutputStream
in interface 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, 2013, Oracle and/or its affiliates. All rights reserved.