javax.activation
Class URLDataSource

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

public class URLDataSource
extends java.lang.Object
implements DataSource

DataSource implementation that retrieves its data from a URL.


Constructor Summary
URLDataSource(java.net.URL url)
          Constructor.
 
Method Summary
 java.lang.String getContentType()
          Returns the Content-Type header for the URL.
 java.io.InputStream getInputStream()
          Returns an input stream from which the data can be read.
 java.lang.String getName()
          Returns the result of getFile of the underlying URL.
 java.io.OutputStream getOutputStream()
          Returns an output stream to which the data can be written.
 java.net.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(java.net.URL url)
Constructor. This will not open the connection to the URL.

Method Detail

getContentType

public java.lang.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 java.lang.String getName()
Returns the result of getFile of the underlying URL.

Specified by:
getName in interface DataSource

getInputStream

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

Specified by:
getInputStream in interface DataSource
Throws:
java.io.IOException

getOutputStream

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

Specified by:
getOutputStream in interface DataSource
Throws:
java.io.IOException

getURL

public java.net.URL getURL()
Returns the underlying URL.