public class AlignmentDataReader extends java.lang.Object
AlignmentModels and DataModels from a stream of JPhyloIO events.| Constructor and Description |
|---|
AlignmentDataReader(java.io.File file)
Creates a new instance of this class.
|
AlignmentDataReader(java.io.File file,
AlignmentModelFactory<?> alignmentModelFactory)
Creates a new instance of this class.
|
AlignmentDataReader(java.io.InputStream stream)
Creates a new instance of this class.
|
AlignmentDataReader(java.io.InputStream stream,
AlignmentModelFactory<?> alignmentModelFactory)
Creates a new instance of this class.
|
AlignmentDataReader(info.bioinfweb.jphyloio.JPhyloIOEventReader eventReader,
AlignmentModelFactory<?> alignmentModelFactory)
Creates a new instance of this class.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addDataModelReader(DataModelEventReader<?> reader)
Adds the specified data model reader to this instance, if it is not already present.
|
AlignmentModelEventReader |
getAlignmentModelReader()
Returns the alignment event reader used create to and read alignment model instances
|
protected info.bioinfweb.jphyloio.events.JPhyloIOEvent |
processNextEvent() |
void |
readAll()
Processes all events from the underlying JPhyloIO event stream.
|
boolean |
removeDataModelReader(DataModelEventReader<?> reader)
Removes the specified data model reader from this instance.
|
public AlignmentDataReader(info.bioinfweb.jphyloio.JPhyloIOEventReader eventReader, AlignmentModelFactory<?> alignmentModelFactory)
A new instance must be created for each stream of JPhyloIO events that shall be processed.
eventReader - the reader providing JPhyloIO eventsalignmentModelFactory - the factory to create alignment model instances during readingjava.lang.NullPointerException - if eventReader or alignmentModelReader are nullpublic AlignmentDataReader(java.io.File file, AlignmentModelFactory<?> alignmentModelFactory) throws java.lang.Exception
The format of the specified files is guessed using
JPhyloIOReaderWriterFactory.guessReader(File, ReadWriteParameterMap).
file - the file to be loadedalignmentModelFactory - the factory to create alignment model instances during readingjava.lang.NullPointerException - if file or alignmentModelReader are nulljava.lang.Exception - if an exception is thrown by
JPhyloIOReaderWriterFactory.guessReader(File, ReadWriteParameterMap) while guessing
the format of filepublic AlignmentDataReader(java.io.InputStream stream, AlignmentModelFactory<?> alignmentModelFactory) throws java.lang.Exception
The format of the specified files is guessed using
JPhyloIOReaderWriterFactory.guessReader(InputStream, ReadWriteParameterMap).
stream - the input stream providing the data to be loadedalignmentModelFactory - the factory to create alignment model instances during readingjava.lang.NullPointerException - if stream or alignmentModelReader are nulljava.lang.Exception - if an exception is thrown by
JPhyloIOReaderWriterFactory.guessReader(InputStream, ReadWriteParameterMap) while guessing
the format of streampublic AlignmentDataReader(java.io.File file) throws java.lang.Exception
The format of the specified files is guessed using
JPhyloIOReaderWriterFactory.guessReader(File, ReadWriteParameterMap) and an instance of
BioPolymerCharAlignmentModelFactory will be used to create new model instances for the loaded data.
file - the file to be loadedjava.lang.NullPointerException - if file is nulljava.lang.Exception - if an exception is thrown by
JPhyloIOReaderWriterFactory.guessReader(File, ReadWriteParameterMap) while guessing
the format of filepublic AlignmentDataReader(java.io.InputStream stream) throws java.lang.Exception
The format of the specified files is guessed using
JPhyloIOReaderWriterFactory.guessReader(InputStream, ReadWriteParameterMap) and an instance of
BioPolymerCharAlignmentModelFactory will be used to create new model instances for the loaded data.
stream - the input stream providing the data to be loadedjava.lang.NullPointerException - if stream is nulljava.lang.Exception - if an exception is thrown by
JPhyloIOReaderWriterFactory.guessReader(InputStream, ReadWriteParameterMap) while guessing
the format of streampublic AlignmentModelEventReader getAlignmentModelReader()
public boolean addDataModelReader(DataModelEventReader<?> reader)
It is recommended to add all readers before the first method that processed events (e.g.
#readUnitlNextAlignmentModel()) is called. If new readers are added in between, its up to the
application developer to make sure that these reader still work properly without knowledge of the events
that were already consumed.
reader - the reader to be addedtrue if the new reader was added, false if the specified reader was already presentjava.lang.IllegalArgumentException - if the specified reader does not reference this instance by
DataModelEventReader.getMainReader()public boolean removeDataModelReader(DataModelEventReader<?> reader)
reader - the reader to be removedtrue if the specified reader was removed, false if that reader was not contained in
this instanceprotected info.bioinfweb.jphyloio.events.JPhyloIOEvent processNextEvent() throws java.lang.Exception
java.lang.Exceptionpublic void readAll() throws java.lang.Exception
AlignmentModelEventReader.getCompletedModels() or by the according
data model readers, if specified before calling this method.java.lang.Exception - if an exception was thrown by JPhyloIOEventReader.next().