public abstract class AbstractTextEventReader<P extends TextReaderStreamDataProvider<? extends AbstractTextEventReader<P>>> extends AbstractEventReader<P>
PeekReader
.
Those are currently readers all reader reading non-XML formats from text files.
Modifier and Type | Field and Description |
---|---|
protected boolean |
lineConsumed |
ATTRIBUTE_STRING_KEY, ATTRIBUTES_NAMESPACE_FOLDER, DATA_TYPE_NAMESPACE_FOLDER, DATA_TYPE_SIMPLE_VALUE_LIST, DEFAULT_CHAR_SET_ID_PREFIX, DEFAULT_CHARACTER_DEFINITION_ID_PREFIX, DEFAULT_EDGE_ID_PREFIX, DEFAULT_GENERAL_ID_PREFIX, DEFAULT_MATRIX_ID_PREFIX, DEFAULT_MAX_COMMENT_LENGTH, DEFAULT_MAX_TOKENS_TO_READ, DEFAULT_META_ID_PREFIX, DEFAULT_NETWORK_ID_PREFIX, DEFAULT_NODE_EDGE_SET_ID_PREFIX, DEFAULT_NODE_ID_PREFIX, DEFAULT_OTU_ID_PREFIX, DEFAULT_OTU_LIST_ID_PREFIX, DEFAULT_OTU_SET_ID_PREFIX, DEFAULT_SEQUENCE_ID_PREFIX, DEFAULT_SEQUENCE_SET_ID_PREFIX, DEFAULT_TOKEN_DEFINITION_ID_PREFIX, DEFAULT_TOKEN_SET_ID_PREFIX, DEFAULT_TREE_ID_PREFIX, DEFAULT_TREE_NETWORK_GROUP_ID_PREFIX, DEFAULT_TREE_NETWORK_SET_ID_PREFIX, JPHYLOIO_ATTRIBUTES_NAMESPACE, JPHYLOIO_ATTRIBUTES_PREFIX, JPHYLOIO_DATA_TYPE_NAMESPACE, JPHYLOIO_DATA_TYPE_PREFIX, JPHYLOIO_FORMATS_NAMESPACE_PREFIX, JPHYLOIO_GENERAL_NAMESPACE, JPHYLOIO_NAMESPACE_PREFIX, JPHYLOIO_PREDICATE_NAMESPACE, JPHYLOIO_PREDICATE_PREFIX, PREDICATE_CHARACTER_COUNT, PREDICATE_EDGE_LENGTH, PREDICATE_EDGE_SOURCE_NODE, PREDICATE_EDGE_TARGET_NODE, PREDICATE_HAS_CUSTOM_XML, PREDICATE_HAS_LITERAL_METADATA, PREDICATE_HAS_RESOURCE_METADATA, PREDICATE_IS_CROSSLINK, PREDICATE_NAMESPACE_FOLDER, PREDICATE_PART_SEPERATOR, PREDICATE_SEQUENCE_COUNT, RESERVED_ID_PREFIX
Constructor and Description |
---|
AbstractTextEventReader(java.io.File file,
ReadWriteParameterMap parameters,
java.lang.String matchToken)
Creates a new instance of this class.
|
AbstractTextEventReader(java.io.InputStream stream,
ReadWriteParameterMap parameters,
java.lang.String matchToken)
Creates a new instance of this class.
|
AbstractTextEventReader(PeekReader reader,
ReadWriteParameterMap parameters,
java.lang.String matchToken)
Creates a new instance of this class.
|
AbstractTextEventReader(java.io.Reader reader,
ReadWriteParameterMap parameters,
java.lang.String matchToken)
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the underlying document source (usually a stream).
|
protected void |
consumeWhiteSpaceAndComments(char commentStart,
char commentEnd) |
protected P |
createStreamDataProvider()
This method is called in the constructor of
AbstractEventReader to initialize the stream
data provider that will be returned by AbstractEventReader.getStreamDataProvider() . |
protected java.util.List<java.lang.String> |
createTokenList(java.lang.CharSequence sequence) |
protected PeekReader |
getReader()
Returns the reader providing the document contents.
|
protected JPhyloIOEvent |
readCharacters(java.lang.String currentSequenceName) |
protected JPhyloIOEvent |
readCharacters(java.lang.String currentSequenceName,
char commentStart,
char commentEnd)
Reads characters from the stream and adds a respective sequence tokens event to the queue.
|
protected void |
readComment(char commentStart,
char commentEnd)
Reads a single comment from the reader.
|
protected KeyValueInformation |
readKeyValueInformation(char commandEnd,
char commentStart,
char commentEnd,
char keyValueSeparator) |
protected java.lang.String |
readToken(char commandEnd,
char commentStart,
char commentEnd,
char keyValueSeparator) |
addEventListener, fireEvent, getCurrentEventCollection, getIDManager, getLastNonCommentEvent, getParameters, getParentInformation, getPreviousEvent, getSequenceTokensEventManager, getStreamDataProvider, getUpcomingEvents, hasNextEvent, hasSpecialEventCollection, isBeforeFirstAccess, next, nextOfType, peek, readNextEvent, removeEventListener, resetCurrentEventCollection, setCurrentEventCollection
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFormatID
protected boolean lineConsumed
public AbstractTextEventReader(PeekReader reader, ReadWriteParameterMap parameters, java.lang.String matchToken)
reader
- the reader providing the document data to be readparameters
- the parameter map for this reader instancematchToken
- the match token to be replaced in sequences or null
if no replacement shall be performedpublic AbstractTextEventReader(java.io.Reader reader, ReadWriteParameterMap parameters, java.lang.String matchToken) throws java.io.IOException
reader
- the reader providing the document data to be readparameters
- the parameter map for this reader instancematchToken
- the match token to be replaced in sequences or null
if no replacement shall be performedjava.io.IOException
public AbstractTextEventReader(java.io.InputStream stream, ReadWriteParameterMap parameters, java.lang.String matchToken) throws java.io.IOException
stream
- the stream providing the document data to be readparameters
- the parameter map for this reader instancematchToken
- the match token to be replaced in sequences or null
if no replacement shall be performedjava.io.IOException
public AbstractTextEventReader(java.io.File file, ReadWriteParameterMap parameters, java.lang.String matchToken) throws java.io.IOException
file
- the document file to be readparameters
- the parameter map for this reader instancematchToken
- the match token to be replaced in sequences or null
if no replacement shall be performedjava.io.IOException
protected P createStreamDataProvider()
AbstractEventReader
AbstractEventReader
to initialize the stream
data provider that will be returned by AbstractEventReader.getStreamDataProvider()
. Inherit classes that use
their own stream data provider implementation should overwrite this method.
This default implementation creates a new instance of ReaderStreamDataProvider
.
createStreamDataProvider
in class AbstractEventReader<P extends TextReaderStreamDataProvider<? extends AbstractTextEventReader<P>>>
protected java.util.List<java.lang.String> createTokenList(java.lang.CharSequence sequence)
protected void consumeWhiteSpaceAndComments(char commentStart, char commentEnd) throws java.io.IOException
java.io.IOException
protected void readComment(char commentStart, char commentEnd) throws java.io.IOException
[comment 1][comment 2]
) would be read. Nested comments are included in the
parsed comment.
This method assumes that the comment start symbol has already been consumed.
java.io.IOException
protected JPhyloIOEvent readCharacters(java.lang.String currentSequenceName) throws java.io.IOException
java.io.IOException
protected JPhyloIOEvent readCharacters(java.lang.String currentSequenceName, char commentStart, char commentEnd) throws java.io.IOException
currentSequenceName
- commentStart
- commentEnd
- java.lang.Exception
java.io.IOException
protected java.lang.String readToken(char commandEnd, char commentStart, char commentEnd, char keyValueSeparator) throws java.io.IOException
java.io.IOException
protected KeyValueInformation readKeyValueInformation(char commandEnd, char commentStart, char commentEnd, char keyValueSeparator) throws java.io.IOException
java.io.IOException
protected PeekReader getReader()
public void close() throws java.io.IOException
JPhyloIOEventReader
close
in interface JPhyloIOEventReader
close
in class AbstractEventReader<P extends TextReaderStreamDataProvider<? extends AbstractTextEventReader<P>>>
java.io.IOException
- Implementing classes might throw different types of exceptions if the stream cannot
be closed properly