javax.activation

Class URLDataSource

public class URLDataSource extends Object implements DataSource

Constructor Summary
URLDataSource(URL url)
Creates a URLDataSource from a URL object.
Method Summary
StringgetContentType()
Returns the value of the URL content-type header field.
InputStreamgetInputStream()
Returns an InputStream obtained from the URL.
StringgetName()
Returns the file name of the URL object.
OutputStreamgetOutputStream()
Returns an OutputStream obtained from the URL.
URLgetURL()
Returns the URL of the data source.

Constructor Detail

URLDataSource

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

Method Detail

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.

getInputStream

public InputStream getInputStream()
Returns an InputStream obtained from the URL.

Returns: the InputStream from URL.openStream()

getName

public String getName()
Returns the file name of the URL object.

Returns: the name as returned by URL.getFile()

getOutputStream

public OutputStream getOutputStream()
Returns an OutputStream obtained from the URL.

getURL

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