javax.activation
Class URLDataSource

java.lang.Object
  extended by javax.activation.URLDataSource
All Implemented Interfaces:
DataSource

public class URLDataSource
extends 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLDataSource

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

Method Detail

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

getName

public String getName()
Returns the result of getFile of the underlying URL.

Specified by:
getName in interface DataSource

getInputStream

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

Specified by:
getInputStream in interface DataSource
Throws:
IOException

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Description copied from interface: DataSource
Returns an output stream to which the data can be written.

Specified by:
getOutputStream in interface DataSource
Throws:
IOException

getURL

public URL getURL()
Returns the underlying URL.