javax.activation

Class URLDataSource

Implemented Interfaces:
DataSource

public class URLDataSource
extends java.lang.Object
implements DataSource

DataSource implementation that retrieves its data from a URL.

Constructor Summary

URLDataSource(URL url)
Constructor.

Method Summary

String
getContentType()
Returns the Content-Type header for the URL.
InputStream
getInputStream()
Returns an input stream from which the data can be read.
String
getName()
Returns the result of getFile of the underlying URL.
OutputStream
getOutputStream()
Returns an output stream to which the data can be written.
URL
getURL()
Returns the underlying URL.

Constructor Details

URLDataSource

public URLDataSource(URL url)
Constructor. This will not open the connection to the URL.

Method Details

getContentType

public String getContentType()
Returns the Content-Type header for the URL. In the case of failure or lack of such a header, returns "application/octet-stream".
Specified by:
getContentType in interface DataSource

getInputStream

public InputStream getInputStream()
            throws IOException
Returns an input stream from which the data can be read.
Specified by:
getInputStream in interface DataSource

getName

public String getName()
Returns the result of getFile of the underlying URL.
Specified by:
getName in interface DataSource

getOutputStream

public OutputStream getOutputStream()
            throws IOException
Returns an output stream to which the data can be written.
Specified by:
getOutputStream in interface DataSource

getURL

public URL getURL()
Returns the underlying URL.