javax.activation

Class URLDataSource

Implemented Interfaces:
DataSource

public class URLDataSource
extends java.lang.Object
implements DataSource

Constructor Summary

URLDataSource(URL url)
Creates a URLDataSource from a URL object.

Method Summary

String
getContentType()
Returns the value of the URL content-type header field.
InputStream
getInputStream()
Returns an InputStream obtained from the URL.
String
getName()
Returns the file name of the URL object.
OutputStream
getOutputStream()
Returns an OutputStream obtained from the URL.
URL
getURL()
Returns the URL of the data source.

Constructor Details

URLDataSource

public URLDataSource(URL url)
Creates a URLDataSource from a URL object.

Method Details

getContentType

public String getContentType()
Returns the value of the URL content-type header field. This method calls URL.openConnection() to obtain a connection from which to obtain the content type. If this fails or a getContentType() returns null then "application/octet-stream" is returned.
Specified by:
getContentType in interface DataSource

getInputStream

public InputStream getInputStream()
            throws IOException
Returns an InputStream obtained from the URL.
Specified by:
getInputStream in interface DataSource
Returns:
the InputStream from URL.openStream()

getName

public String getName()
Returns the file name of the URL object.
Specified by:
getName in interface DataSource
Returns:
the name as returned by URL.getFile()

getOutputStream

public OutputStream getOutputStream()
            throws IOException
Returns an OutputStream obtained from the URL.
Specified by:
getOutputStream in interface DataSource

getURL

public URL getURL()
Returns the URL of the data source.