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

Version:
$Rev: 467742 $ $Date: 2006-10-25 21:30:38 +0200 (Wed, 25 Oct 2006) $

Constructor Summary
URLDataSource(java.net.URL url)
          Creates a URLDataSource from a URL object.
 
Method Summary
 java.lang.String getContentType()
          Returns the value of the URL content-type header field.
 java.io.InputStream getInputStream()
          Returns an InputStream obtained from the URL.
 java.lang.String getName()
          Returns the file name of the URL object.
 java.io.OutputStream getOutputStream()
          Returns an OutputStream obtained from the URL.
 java.net.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(java.net.URL url)
Creates a URLDataSource from a URL object.

Method Detail

getContentType

public java.lang.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 java.lang.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 java.io.InputStream getInputStream()
                                   throws java.io.IOException
Returns an InputStream obtained from the URL.

Specified by:
getInputStream in interface DataSource
Returns:
the InputStream from URL.openStream()
Throws:
java.io.IOException

getOutputStream

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

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

getURL

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



Copyright © 2008. All Rights Reserved.