javax.activation
Class FileDataSource
java.lang.Object
javax.activation.FileDataSource
- DataSource
public class FileDataSource
extends java.lang.Object
Data source encapsulating a file.
String | getContentType() - Returns the MIME content type of the data.
|
File | getFile() - Returns the underlying file.
|
InputStream | getInputStream() - Returns an input stream from which the data can be read.
|
String | getName() - Returns the underlying name of this object.
|
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.
|
FileDataSource
public FileDataSource(File file)
Constructor.
file
- the underlying file to use
FileDataSource
public FileDataSource(String name)
Constructor.
name
- the path to the underlying file to use
getContentType
public String getContentType()
Returns the MIME content type of the data.
- getContentType in interface DataSource
getFile
public File getFile()
Returns the underlying file.
getInputStream
public InputStream getInputStream()
throws IOException
Returns an input stream from which the data can be read.
- getInputStream in interface DataSource
getName
public String getName()
Returns the underlying name of this object.
- getName in interface DataSource
getOutputStream
public OutputStream getOutputStream()
throws IOException
Returns an output stream to which the data can be written.
- 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.
map
- the file type map