javax.activation
Class URLDataSource

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

public class URLDataSource
extends Object
implements DataSource

Version:
$Rev: 123385 $ $Date: 2004-12-26 19:54:49 -0800 (Sun, 26 Dec 2004) $

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.
 
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)
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.

Specified by:
getContentType in interface DataSource

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()

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()
Throws:
IOException

getOutputStream

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

Specified by:
getOutputStream in interface DataSource
Throws:
IOException

getURL

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



Copyright © 2006 Apache Software Foundation. All Rights Reserved.