- java.lang.Object
- 
- jakarta.activation.URLDataSource
 
- 
- All Implemented Interfaces:
- DataSource
 
 public class URLDataSource extends java.lang.Object implements DataSource The URLDataSource class provides an object that wraps aURLobject in a DataSource interface. URLDataSource simplifies the handling of data described by URLs within Jakarta Activation 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 SummaryConstructors Constructor Description URLDataSource(java.net.URL url)URLDataSource constructor.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetContentType()Returns the value of the URL content-type header field.java.io.InputStreamgetInputStream()The getInputStream method from the URL.java.lang.StringgetName()Calls thegetFilemethod on the URL used to instantiate the object.java.io.OutputStreamgetOutputStream()The getOutputStream method from the URL.java.net.URLgetURL()Return the URL used to create this DataSource.
 
- 
- 
- 
Method Detail- 
getContentTypepublic java.lang.String getContentType() Returns the value of the URL content-type header field. It calls the URL'sURLConnection.getContentTypemethod after retrieving a URLConnection object. Note: this method attempts to call theopenConnectionmethod 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:
- getContentTypein interface- DataSource
- Returns:
- the content type.
 
 - 
getNamepublic java.lang.String getName() Calls thegetFilemethod on the URL used to instantiate the object.- Specified by:
- getNamein interface- DataSource
- Returns:
- the result of calling the URL's getFile method.
 
 - 
getInputStreampublic java.io.InputStream getInputStream() throws java.io.IOExceptionThe getInputStream method from the URL. Calls theopenStreammethod on the URL.- Specified by:
- getInputStreamin interface- DataSource
- Returns:
- the InputStream.
- Throws:
- java.io.IOException- for failures creating the InputStream
 
 - 
getOutputStreampublic java.io.OutputStream getOutputStream() throws java.io.IOExceptionThe 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:
- getOutputStreamin interface- DataSource
- Returns:
- the OutputStream.
- Throws:
- java.io.IOException- for failures creating the OutputStream
 
 - 
getURLpublic java.net.URL getURL() Return the URL used to create this DataSource.- Returns:
- The URL.
 
 
- 
 
-