Package jakarta.activation
Class URLDataSource
java.lang.Object
jakarta.activation.URLDataSource
- All Implemented Interfaces:
- 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 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:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionReturns the value of the URL content-type header field.The getInputStream method from the URL.getName()Calls thegetFilemethod on the URL used to instantiate the object.The getOutputStream method from the URL.getURL()Return the URL used to create this DataSource.
- 
Constructor Details- 
URLDataSourceURLDataSource 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 Details- 
getContentTypeReturns 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.
 
- 
getNameCalls thegetFilemethod on the URL used to instantiate the object.- Specified by:
- getNamein interface- DataSource
- Returns:
- the result of calling the URL's getFile method.
 
- 
getInputStreamThe getInputStream method from the URL. Calls theopenStreammethod on the URL.- Specified by:
- getInputStreamin interface- DataSource
- Returns:
- the InputStream.
- Throws:
- IOException- for failures creating the InputStream
 
- 
getOutputStreamThe 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:
- IOException- for failures creating the OutputStream
 
- 
getURLReturn the URL used to create this DataSource.- Returns:
- The URL.
 
 
-