|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.activation.FileDataSource
public class FileDataSource
The FileDataSource class implements a simple DataSource object that encapsulates a file. It provides data typing services via a FileTypeMap object.
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.
DataSource
,
FileTypeMap
,
MimetypesFileTypeMap
Constructor Summary | |
---|---|
FileDataSource(java.io.File file)
Creates a FileDataSource from a File object. |
|
FileDataSource(java.lang.String name)
Creates a FileDataSource from the specified path name. |
Method Summary | |
---|---|
java.lang.String |
getContentType()
This method returns the MIME type of the data in the form of a string. |
java.io.File |
getFile()
Return the File object that corresponds to this FileDataSource. |
java.io.InputStream |
getInputStream()
This method will return an InputStream representing the the data and will throw an IOException if it can not do so. |
java.lang.String |
getName()
Return the name of this object. |
java.io.OutputStream |
getOutputStream()
This method will return an OutputStream representing the the data and will throw an IOException if it can not do so. |
void |
setFileTypeMap(FileTypeMap map)
Set the FileTypeMap to use with this FileDataSource |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileDataSource(java.io.File file)
file
- the filepublic FileDataSource(java.lang.String name)
name
- the system-dependent file name.Method Detail |
---|
public java.io.InputStream getInputStream() throws java.io.IOException
getInputStream
in interface DataSource
java.io.IOException
public java.io.OutputStream getOutputStream() throws java.io.IOException
getOutputStream
in interface DataSource
java.io.IOException
public java.lang.String getContentType()
getDefaultFileTypeMap
method on
FileTypeMap to acquire a default FileTypeMap. Note: By
default, the FileTypeMap used will be a MimetypesFileTypeMap.
getContentType
in interface DataSource
FileTypeMap.getDefaultFileTypeMap()
public java.lang.String getName()
getName
in interface DataSource
DataSource
public java.io.File getFile()
public void setFileTypeMap(FileTypeMap map)
map
- The FileTypeMap for this object.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2009, 2010, Oracle Corporation and/or its affiliates. All Rights Reserved. Use is subject to license terms.
Generated on 4-June-2010 04:34