public class FileDataSource extends java.lang.Object implements DataSource
Constructor and Description |
---|
FileDataSource(java.io.File file)
Constructor.
|
FileDataSource(java.lang.String name)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public FileDataSource(java.io.File file)
file
- the underlying file to usepublic FileDataSource(java.lang.String name)
name
- the path to the underlying file to usepublic java.io.InputStream getInputStream() throws java.io.IOException
DataSource
getInputStream
in interface DataSource
java.io.IOException
public java.io.OutputStream getOutputStream() throws java.io.IOException
DataSource
getOutputStream
in interface DataSource
java.io.IOException
public java.lang.String getContentType()
DataSource
getContentType
in interface DataSource
public java.lang.String getName()
DataSource
getName
in interface DataSource
public java.io.File getFile()
public void setFileTypeMap(FileTypeMap map)
map
- the file type map