Merge branch 'develop' into bug/JAL-2255_seq-fetcher-broken-on-linux
[jalview.git] / src / jalview / io / FileFormatI.java
diff --git a/src/jalview/io/FileFormatI.java b/src/jalview/io/FileFormatI.java
new file mode 100644 (file)
index 0000000..e6f390d
--- /dev/null
@@ -0,0 +1,63 @@
+package jalview.io;
+
+import jalview.datamodel.AlignmentI;
+
+import java.io.IOException;
+
+public interface FileFormatI
+{
+  AlignmentFileReaderI getReader(FileParse source) throws IOException;
+
+  AlignmentFileWriterI getWriter(AlignmentI al);
+
+  boolean isComplexAlignFile();
+
+  /**
+   * Answers the display name of the file format (as for example shown in menu
+   * options). This name should not be locale (language) dependent.
+   */
+  String getName();
+
+  /**
+   * Returns a comma-separated list of file extensions associated with the
+   * format
+   * 
+   * @return
+   */
+  String getExtensions();
+
+  /**
+   * Answers true if the format is one that Jalview can read. This implies that
+   * the format provides an implementation for getReader which can parse a data
+   * source for sequence data. Readable formats are included in the options in
+   * the open file dialogue.
+   * 
+   * @return
+   */
+  boolean isReadable();
+
+  /**
+   * Answers true if the format is one that Jalview can write. This implies that
+   * the object returned by getWriter provides an implementation of the print()
+   * method. Writable formats are included in the options in the Save As file
+   * dialogue, and the 'output to Textbox' option (if text format).
+   * 
+   * @return
+   */
+  boolean isWritable();
+
+  /**
+   * Answers true if the format is one that Jalview can output as text, e.g. to
+   * a text box
+   * 
+   * @return
+   */
+  boolean isTextFormat();
+
+  /**
+   * Answers true if the file format is one that provides 3D structure data
+   * 
+   * @return
+   */
+  boolean isStructureFile();
+}