public interface SingleReaderWriterFactory
JPhyloIOReaderWriterFactory
to create reader
and writer instances of a specific format. There must be one implementation if this interface for each format
provided to JPhyloIOReaderWriterFactory
.
Application or third party library developers who wish to add readers or writers for additional formats to
JPhyloIOReaderWriterFactory
, should provide an according implementation of this interface which may
than be regisgered using JPhyloIOReaderWriterFactory.addFactory(SingleReaderWriterFactory)
.
Modifier and Type | Method and Description |
---|---|
boolean |
checkFormat(java.io.InputStream stream,
ReadWriteParameterMap parameters)
Implementations should read the start of the stream here and determine whether the content could be valid
according to the target format.
|
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.
|
JPhyloIOFormatInfo |
getFormatInfo()
Returns an information objects describing the target format and providing according file filters.
|
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.
|
boolean checkFormat(java.io.InputStream stream, ReadWriteParameterMap parameters) throws java.lang.Exception
stream
- the stream to read the first bytes fromparameters
- the parameters map that would also be used to create a readertrue
if the tested stream may be in the target format or false
if the stream is not
in valid target formatjava.lang.Exception
boolean checkFormat(java.io.Reader reader, ReadWriteParameterMap parameters) throws java.lang.Exception
reader
- the reader to read the first bytes fromparameters
- the parameters map that would also be used to create a readertrue
if the tested reader may return content in target format or false
if the content is not
in valid target formatjava.lang.Exception
JPhyloIOEventReader getReader(java.io.InputStream stream, ReadWriteParameterMap parameters) throws java.lang.Exception
stream
- the stream to provide the content for the readerparameters
- the parameter map for the new reader instancejava.lang.Exception
JPhyloIOEventReader getReader(java.io.Reader reader, ReadWriteParameterMap parameters) throws java.lang.Exception
stream
- the stream to provide the content for the readerparameters
- the parameter map for the new reader instancenull
if this factory is not able to create readersjava.lang.Exception
hasReader()
JPhyloIOEventWriter getWriter()
null
if this factory is not able to create writershasWriter()
JPhyloIOFormatInfo getFormatInfo()
boolean hasReader()
true
if creating readers is supported or false
otherwiseboolean hasWriter()
true
if creating writers is supported or false
otherwise