info.bioinfweb.jphyloio.factory

## Class AbstractStartStringSingleFactory

- java.lang.Object
- - info.bioinfweb.jphyloio.factory.AbstractSingleReaderWriterFactory
  - - info.bioinfweb.jphyloio.factory.AbstractStartStringSingleFactory

- All Implemented Interfaces:
    SingleReaderWriterFactory
  Direct Known Subclasses:
    FASTAFactory, MEGAFactory, NexusFactory

      public abstract class AbstractStartStringSingleFactory
      extends AbstractSingleReaderWriterFactory
      implements SingleReaderWriterFactory

  Abstract single format factory that implements the `checkFormat()` methods by testing of the read content start with a certain string, determined by `getExpectedStart()`.
  Since:
    0.0.0
  Author:
    Ben Stöver

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractStartStringSingleFactory(java.lang.String expectedStart)` Creates a new instance of this class.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `checkFormat(java.io.Reader reader, ReadWriteParameterMap parameters)` Implementations should read the start of the characters returned by the reader here and determine whether the content could be valid according to the target format.
    `protected java.lang.String` | `getExpectedStart()`

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

      `checkFormat, createFormatInfo, 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, getFormatInfo, getReader, getReader, getWriter, hasReader, hasWriter`

- - ### Constructor Detail

    - #### AbstractStartStringSingleFactory

          public AbstractStartStringSingleFactory(java.lang.String expectedStart)

      Creates a new instance of this class.
      Parameters:
        `expectedStart` - the start of the content to be expected if it is valid for the target format

  - ### Method Detail

    - #### getExpectedStart

          protected java.lang.String getExpectedStart()

    - #### checkFormat

          public boolean checkFormat(java.io.Reader reader,
                                     ReadWriteParameterMap parameters)
                              throws java.io.IOException

      Description copied from interface: `SingleReaderWriterFactory`
      Implementations should read the start of the characters returned by the reader here and determine whether the content could be valid according to the target format.
      Specified by:
        `checkFormat` in interface `SingleReaderWriterFactory`
      Parameters:
        `reader` - the reader to read the first bytes from
        `parameters` - the parameters map that would also be used to create a reader
      Returns:
        `true` if the tested reader may return content in target format or `false` if the content is not in valid target format
      Throws:
        `java.io.IOException`