info.bioinfweb.jphyloio.formats.fasta

## Class FASTAFactory

- java.lang.Object
- - info.bioinfweb.jphyloio.factory.AbstractSingleReaderWriterFactory
  - - info.bioinfweb.jphyloio.factory.AbstractStartStringSingleFactory
    - - info.bioinfweb.jphyloio.formats.fasta.FASTAFactory

- All Implemented Interfaces:
    SingleReaderWriterFactory, FASTAConstants, JPhyloIOFormatIDs

      public class FASTAFactory
      extends AbstractStartStringSingleFactory
      implements SingleReaderWriterFactory, JPhyloIOFormatIDs, FASTAConstants

  Reader and writer factory for the FASTA format.

  The `checkFormat()` methods test, if the content starts with `FASTAConstants.NAME_START_CHAR`. They will therefore return `false` for empty files, which might anyway be FASTA files containing no sequences.

  Since:
    0.0.0
  Author:
    Ben Stöver

- - ### Field Summary

    - ### Fields inherited from interface info.bioinfweb.jphyloio.formats.JPhyloIOFormatIDs

      `FASTA_FORMAT_ID, FORMAT_ID_PREFIX, MEGA_FORMAT_ID, NEWICK_FORMAT_ID, NEXML_FORMAT_ID, NEXUS_FORMAT_ID, PDE_FORMAT_ID, PHYLIP_FORMAT_ID, PHYLOXML_FORMAT_ID, SEQUENTIAL_PHYLIP_FORMAT_ID, XTG_FORMAT_ID`

    - ### Fields inherited from interface info.bioinfweb.jphyloio.formats.fasta.FASTAConstants

      `COMMENT_START_CHAR, DEFAULT_LINE_LENGTH, FASTA_FORMAT_NAME, NAME_START_CHAR`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FASTAFactory()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected JPhyloIOFormatInfo` | `createFormatInfo()` Returns the FASTA format info including a file filter that specifies the file extensions listed here.
    `JPhyloIOEventReader` | `getReader(java.io.InputStream stream, ReadWriteParameterMap parameters)` Creates a new reader instance for the target format of this factory.
    `JPhyloIOEventReader` | `getReader(java.io.Reader reader, ReadWriteParameterMap parameters)` Creates a new reader instance for the target format of this factory.
    `JPhyloIOEventWriter` | `getWriter()` Creates a new writer instance for the target format of this factory.
    `boolean` | `hasReader()` Determines whether this factory is able to create reader instances for its target format.
    `boolean` | `hasWriter()` Determines whether this factory is able to create writer instances for its target format.

    - ### Methods inherited from class info.bioinfweb.jphyloio.factory.AbstractStartStringSingleFactory

      `checkFormat, getExpectedStart`

    - ### Methods inherited from class info.bioinfweb.jphyloio.factory.AbstractSingleReaderWriterFactory

      `checkFormat, getFormatInfo`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface info.bioinfweb.jphyloio.factory.SingleReaderWriterFactory

      `checkFormat, checkFormat, getFormatInfo`

- - ### Constructor Detail

    - #### FASTAFactory

          public FASTAFactory()

  - ### Method Detail

    - #### getReader

          public JPhyloIOEventReader getReader(java.io.InputStream stream,
                                               ReadWriteParameterMap parameters)
                                        throws java.io.IOException

      Description copied from interface: `SingleReaderWriterFactory`
      Creates a new reader instance for the target format of this factory.
      Specified by:
        `getReader` in interface `SingleReaderWriterFactory`
      Parameters:
        `stream` - the stream to provide the content for the reader
        `parameters` - the parameter map for the new reader instance
      Returns:
        the new reader instance
      Throws:
        `java.io.IOException`

    - #### getReader

          public JPhyloIOEventReader getReader(java.io.Reader reader,
                                               ReadWriteParameterMap parameters)
                                        throws java.io.IOException

      Description copied from interface: `SingleReaderWriterFactory`
      Creates a new reader instance for the target format of this factory.
      Specified by:
        `getReader` in interface `SingleReaderWriterFactory`
        `parameters` - the parameter map for the new reader instance
      Returns:
        the new reader instance or `null` if this factory is not able to create readers
      Throws:
        `java.io.IOException`
      See Also:
        `SingleReaderWriterFactory.hasReader()`

    - #### getWriter

          public JPhyloIOEventWriter getWriter()

      Description copied from interface: `SingleReaderWriterFactory`
      Creates a new writer instance for the target format of this factory.
      Specified by:
        `getWriter` in interface `SingleReaderWriterFactory`
      Returns:
        the new writer instance or `null` if this factory is not able to create writers
      See Also:
        `SingleReaderWriterFactory.hasWriter()`

    - #### hasReader

          public boolean hasReader()

      Description copied from interface: `SingleReaderWriterFactory`
      Determines whether this factory is able to create reader instances for its target format.
      Specified by:
        `hasReader` in interface `SingleReaderWriterFactory`
      Returns:
        `true` if creating readers is supported or `false` otherwise

    - #### hasWriter

          public boolean hasWriter()

      Description copied from interface: `SingleReaderWriterFactory`
      Determines whether this factory is able to create writer instances for its target format.
      Specified by:
        `hasWriter` in interface `SingleReaderWriterFactory`
      Returns:
        `true` if creating writers is supported or `false` otherwise

    - #### createFormatInfo

          protected JPhyloIOFormatInfo createFormatInfo()

      Returns the FASTA format info including a file filter that specifies the file extensions listed here.
      Specified by:
        `createFormatInfo` in class `AbstractSingleReaderWriterFactory`
      See Also:
        `SingleReaderWriterFactory.getFormatInfo()`