Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class ncsa.horizon.model.SupportedFileFormat

java.lang.Object
  |
  +--ncsa.horizon.model.FileFormat
        |
        +--ncsa.horizon.model.SupportedFileFormat
Subclasses:
HorizonSupportedFileFormat, SimplySupportedFileFormat

public abstract class SupportedFileFormat
extends FileFormat
a class encapsulating file formats that are supported through developer-provided code. To support a new format or group of formats, one can subclass this class.

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.

See Also:
Serialized Form

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

name

protected java.lang.String name

description

protected java.lang.String description

mimetypes

protected java.lang.String[] mimetypes

mn

protected MagicNumber mn

reference

protected java.lang.String reference

refURL

protected java.lang.String refURL

exts

protected java.lang.String[] exts
Constructor Detail

SupportedFileFormat

protected SupportedFileFormat()

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)
this will initialize the basic data
Parameters:
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
Throws:
java.lang.IllegalArgumentException - if nm is null or the
Method Detail

getName

public java.lang.String getName()
get the name of this file format. The return should be non-null.
Overrides:
getName in class FileFormat

getDescription

public java.lang.String getDescription()
return a short string describing the format. This can be null.
Overrides:
getDescription in class FileFormat

getReference

public java.lang.String getReference()
return a string giving a reference to definition of or information about the format. This can be null.
Overrides:
getReference in class FileFormat

getReferenceURL

public java.lang.String getReferenceURL()
return a URL string to a reference to definition of or information about the format. This can be null.
Overrides:
getReferenceURL in class FileFormat

getContentTypes

public java.lang.String[] getContentTypes()
return the MIME type for this file format instance or null if unknown.
Overrides:
getContentTypes in class FileFormat

getMagicNumber

public 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.
Overrides:
getMagicNumber in class FileFormat
See Also:
MagicNumber

getExtensions

public java.lang.String[] getExtensions()
return a list of the recognized file extensions identifying a file as having this format. These extensions should start with a period if applicable.
Overrides:
getExtensions in class FileFormat

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD