javax.activation

Class FileDataSource

Implemented Interfaces:
DataSource

public class FileDataSource
extends java.lang.Object
implements DataSource

Data source encapsulating a file.

Constructor Summary

FileDataSource(File file)
Constructor.
FileDataSource(String name)
Constructor.

Method Summary

String
getContentType()
File
getFile()
Returns the underlying file.
InputStream
getInputStream()
String
getName()
OutputStream
getOutputStream()
void
setFileTypeMap(FileTypeMap map)
Sets the file type map to use to determine the content type of the file.

Constructor Details

FileDataSource

public FileDataSource(File file)
Constructor.
Parameters:
file - the underlying file to use

FileDataSource

public FileDataSource(String name)
Constructor.
Parameters:
name - the path to the underlying file to use

Method Details

getContentType

public String getContentType()
Specified by:
getContentType in interface DataSource

getFile

public File getFile()
Returns the underlying file.

getInputStream

public InputStream getInputStream()
            throws IOException
Specified by:
getInputStream in interface DataSource

getName

public String getName()
Specified by:
getName in interface DataSource

getOutputStream

public OutputStream getOutputStream()
            throws IOException
Specified by:
getOutputStream in interface DataSource

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