javax.activation
Class FileDataSource

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

public class FileDataSource
extends java.lang.Object
implements DataSource

Data source encapsulating a file.


Constructor Summary
FileDataSource(java.io.File file)
          Constructor.
FileDataSource(java.lang.String name)
          Constructor.
 
Method Summary
 java.lang.String getContentType()
          Returns the MIME content type of the data.
 java.io.File getFile()
          Returns the underlying file.
 java.io.InputStream getInputStream()
          Returns an input stream from which the data can be read.
 java.lang.String getName()
          Returns the underlying name of this object.
 java.io.OutputStream getOutputStream()
          Returns an output stream to which the data can be written.
 void setFileTypeMap(FileTypeMap map)
          Sets the file type map to use to determine the content type of the file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileDataSource

public FileDataSource(java.io.File file)
Constructor.

Parameters:
file - the underlying file to use

FileDataSource

public FileDataSource(java.lang.String name)
Constructor.

Parameters:
name - the path to the underlying file to use
Method Detail

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

getContentType

public java.lang.String getContentType()
Description copied from interface: DataSource
Returns the MIME content type of the data.

Specified by:
getContentType in interface DataSource

getName

public java.lang.String getName()
Description copied from interface: DataSource
Returns the underlying name of this object.

Specified by:
getName in interface DataSource

getFile

public java.io.File getFile()
Returns the underlying file.


setFileTypeMap

public void setFileTypeMap(FileTypeMap map)
Sets the file type map to use to determine the content type of the file.

Parameters:
map - the file type map