javax.activation

Class FileDataSource

public class FileDataSource extends Object implements DataSource

Data source encapsulating a file.
Constructor Summary
FileDataSource(File file)
Constructor.
FileDataSource(String name)
Constructor.
Method Summary
StringgetContentType()
FilegetFile()
Returns the underlying file.
InputStreamgetInputStream()
StringgetName()
OutputStreamgetOutputStream()
voidsetFileTypeMap(FileTypeMap map)
Sets the file type map to use to determine the content type of the file.

Constructor Detail

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 Detail

getContentType

public String getContentType()

getFile

public File getFile()
Returns the underlying file.

getInputStream

public InputStream getInputStream()

getName

public String getName()

getOutputStream

public OutputStream getOutputStream()

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