FileDataSource Typing Semantics
The FileDataSource class delegates data typing of files
to an object subclassed from the FileTypeMap class.
The setFileTypeMap method can be used to explicitly
set the FileTypeMap for an instance of FileDataSource. If no
FileTypeMap is set, the FileDataSource will call the FileTypeMap's
getDefaultFileTypeMap method to get the System's default FileTypeMap.
javax.activation.DataSource, javax.activation.FileTypeMap, javax.activation.MimetypesFileTypeMap
| Modifier and Type | Field and Description |
|---|---|
| private File | |
| private FileTypeMap |
| Access | Constructor and Description |
|---|---|
| public | |
| public | FileDataSource(String
the system-dependent file name. name)Creates a FileDataSource from the specified path name. |
| Modifier and Type | Method and Description |
|---|---|
| public String | Returns: the MIME TypeImplements javax. |
| public File | Returns: the File object for the file represented by this object.Return the File object that corresponds to this FileDataSource. |
| public InputStream | Returns: an InputStreamImplements javax. |
| public String | Returns: the name of the object.Implements javax. |
| public OutputStream | Returns: an OutputStreamImplements javax. |
| public void | setFileTypeMap(FileTypeMap
The FileTypeMap for this object. map)Set the FileTypeMap to use with this FileDataSource |
| _file | back to summary |
|---|---|
| private File _file | |
| typeMap | back to summary |
|---|---|
| private FileTypeMap typeMap | |
| FileDataSource | back to summary |
|---|---|
| public FileDataSource(File file) Creates a FileDataSource from a File object. Note The file will not actually be opened until a method is called that requires the file to be opened.
| |
| FileDataSource | back to summary |
|---|---|
| public FileDataSource(String name) Creates a FileDataSource from the specified path name. Note The file will not actually be opened until a method is called that requires the file to be opened.
| |
| getContentType | back to summary |
|---|---|
| public String getContentType() Implements javax. This method returns the MIME type of the data in the form of a
string. This method uses the currently installed FileTypeMap. If
there is no FileTypeMap explictly set, the FileDataSource will
call the Note By default, the FileTypeMap used will be a MimetypesFileTypeMap.
| |
| getFile | back to summary |
|---|---|
| public File getFile() Return the File object that corresponds to this FileDataSource.
| |
| getInputStream | back to summary |
|---|---|
| public InputStream getInputStream() throws IOException Implements javax. This method will return an InputStream representing the the data and will throw an IOException if it can not do so. This method will return a new instance of InputStream with each invocation.
| |
| getName | back to summary |
|---|---|
| public String getName() Implements javax. Return the name of this object. The FileDataSource will return the file name of the object.
| |
| getOutputStream | back to summary |
|---|---|
| public OutputStream getOutputStream() throws IOException Implements javax. This method will return an OutputStream representing the the data and will throw an IOException if it can not do so. This method will return a new instance of OutputStream with each invocation.
| |
| setFileTypeMap | back to summary |
|---|---|
| public void setFileTypeMap(FileTypeMap map) Set the FileTypeMap to use with this FileDataSource
| |