loci.formats
Class FormatHandler

java.lang.Object
  extended byloci.formats.FormatHandler
Direct Known Subclasses:
FormatReader, FormatWriter

public abstract class FormatHandler
extends Object

Abstract superclass of all biological file format readers and writers.


Field Summary
protected  JFileChooser chooser
          File chooser for this file format.
protected  String currentId
          Name of current file.
protected  FileFilter[] filters
          File filters for this file format, for use with a JFileChooser.
protected  String format
          Name of this file format.
protected  String[] suffixes
          Valid suffixes for this file format.
 
Constructor Summary
FormatHandler(String format, String suffix)
          Constructs a format handler with the given name and default suffix.
FormatHandler(String format, String[] suffixes)
          Constructs a format handler with the given name and default suffixes.
 
Method Summary
protected  void createFilters()
          Creates JFileChooser file filters for this file format.
 JFileChooser getFileChooser()
          Gets a JFileChooser that recognizes accepted file types.
 FileFilter[] getFileFilters()
          Gets file filters for this file format, for use with a JFileChooser.
 String getFormat()
          Gets the name of this file format.
 String[] getSuffixes()
          Gets the default file suffixes for this file format.
 boolean isThisType(String name)
          Checks if the given string is a valid filename for this file format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

format

protected String format
Name of this file format.


suffixes

protected String[] suffixes
Valid suffixes for this file format.


filters

protected FileFilter[] filters
File filters for this file format, for use with a JFileChooser.


chooser

protected JFileChooser chooser
File chooser for this file format.


currentId

protected String currentId
Name of current file.

Constructor Detail

FormatHandler

public FormatHandler(String format,
                     String suffix)
Constructs a format handler with the given name and default suffix.


FormatHandler

public FormatHandler(String format,
                     String[] suffixes)
Constructs a format handler with the given name and default suffixes.

Method Detail

createFilters

protected void createFilters()
Creates JFileChooser file filters for this file format.


isThisType

public boolean isThisType(String name)
Checks if the given string is a valid filename for this file format. The default implementation checks filename suffixes against those known for this format.


getFormat

public String getFormat()
Gets the name of this file format.


getSuffixes

public String[] getSuffixes()
Gets the default file suffixes for this file format.


getFileFilters

public FileFilter[] getFileFilters()
Gets file filters for this file format, for use with a JFileChooser.


getFileChooser

public JFileChooser getFileChooser()
Gets a JFileChooser that recognizes accepted file types.