| Overview | Package | Class | Tree | Deprecated | Index | Help | |||
| PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||
java.lang.Object
|
+--ncsa.horizon.model.FileFormat
|
+--ncsa.horizon.model.SupportedFileFormat
See FileFormat for a full description of the purpose of this class.
Supporting New File Formats
Horizon uses the FileFormat class as first tool for supporting a format in an automated, format-independent way. In particular, the Dataset class will open a file of some type by first determining its format type by testing it against known file formats, each of which are represented by an instance of this class. Thus, to add such automatic support for a new class, one must represent a format by a FileFormat object.
This is most easily done by instantiating the SimplySupportedFileFormat class with parameters that properly describe the new format. However, one can take greater control of handling the identification of a file format and/or the creation of a FormatHandler object to read the file by subclassing this class. It provides default implementations of all methods save the createFormatHandler() method.
To allow fully automated support for the new format in a Horizon application, the application should instantiate a FileFormat object and register it with the Horizon system via Horizon.supportFileFormat(). This allows an application to handle files ofthe new format in an automated way along side of other supported formats without explicit knowledge of its actual format.
| Field Summary | |
| java.lang.String | description
|
| java.lang.String[] | exts
|
| java.lang.String[] | mimetypes
|
| MagicNumber | mn
|
| java.lang.String | name
|
| java.lang.String | reference
|
| java.lang.String | refURL
|
| Constructor Summary | |
| SupportedFileFormat()
|
|
| SupportedFileFormat(java.lang.String nm,
java.lang.String desc,
java.lang.String ref,
java.lang.String refURL,
java.lang.String[] ex,
MagicNumber mnum,
java.lang.String[] mimes)
this will initialize the basic data |
|
| Method Summary | |
| java.lang.String[] | getContentTypes()
return the MIME type for this file format instance or null if unknown. |
| java.lang.String | getDescription()
return a short string describing the format. |
| java.lang.String[] | getExtensions()
return a list of the recognized file extensions identifying a file as having this format. |
| MagicNumber | getMagicNumber()
return a MagicNumber object that represents the leading byte signiture for the file format, or null if such a signiture is not known. |
| java.lang.String | getName()
get the name of this file format. |
| java.lang.String | getReference()
return a string giving a reference to definition of or information about the format. |
| java.lang.String | getReferenceURL()
return a URL string to a reference to definition of or information about the format. |
| Methods inherited from class ncsa.horizon.model.FileFormat | |
| createFormatHandler, getContentTypes, getDescription, getExtensions, getMagicNumber, getName, getReference, getReferenceURL | |
| Methods inherited from class java.lang.Object | |
| clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait | |
| Field Detail |
protected java.lang.String name
protected java.lang.String description
protected java.lang.String[] mimetypes
protected MagicNumber mn
protected java.lang.String reference
protected java.lang.String refURL
protected java.lang.String[] exts
| Constructor Detail |
protected SupportedFileFormat()
public SupportedFileFormat(java.lang.String nm,
java.lang.String desc,
java.lang.String ref,
java.lang.String refURL,
java.lang.String[] ex,
MagicNumber mnum,
java.lang.String[] mimes)
nm
- the name of the format
desc
- the description of the class
ref
- a reference to a document explaining/defining the format
refURL
- a URL to a document explaining/defining the format
mnum
- the MagicNumber for the class
ex
- an array of recognized file extensions for this format| Method Detail |
public java.lang.String getName()
public java.lang.String getDescription()
public java.lang.String getReference()
public java.lang.String getReferenceURL()
public java.lang.String[] getContentTypes()
public MagicNumber getMagicNumber()
public java.lang.String[] getExtensions()
| Overview | Package | Class | Tree | Deprecated | Index | Help | |||
| PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||