|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jebl.evolution.io.ImportHelper
public class ImportHelper
A helper class for phylogenetic file format importers
Constructor Summary | |
---|---|
ImportHelper(Reader reader)
ATTENTION: The ImportHelper never closes the reader passed to the constructor. |
|
ImportHelper(Reader reader,
Writer commentWriter)
|
Method Summary | |
---|---|
void |
clearLastMetaComment()
|
void |
closeReader()
|
int |
getLastDelimiter()
|
String |
getLastMetaComment()
|
int |
getLineNumber()
|
double |
getProgress()
|
char |
next()
|
char |
nextCharacter()
|
char |
read()
All read attempts pass through this function. |
char |
readCharacter()
|
double |
readDouble()
Attempts to read and parse a double delimited by whitespace. |
double |
readDouble(String delimiters)
Attempts to read and parse a double delimited by whitespace or by any character in delimiters. |
int |
readInteger()
Attempts to read and parse an integer delimited by whitespace. |
int |
readInteger(String delimiters)
Attempts to read and parse an integer delimited by whitespace or by any character in delimiters. |
String |
readLine()
Reads a line, skipping over any comments. |
void |
readSequence(StringBuilder sequence,
SequenceType sequenceType,
String delimiters,
int maxSites,
String gapCharacters,
String missingCharacters,
String matchCharacters,
String matchSequence)
|
void |
readSequence(StringBuilder sequence,
SequenceType sequenceType,
String delimiters,
int maxSites,
String gapCharacters,
String missingCharacters,
String matchCharacters,
String matchSequence,
ProgressListener progress)
Reads sequence, skipping over any comments and filtering using sequenceType. |
void |
readSequenceLine(StringBuffer sequence,
SequenceType sequenceType,
String delimiters,
String gapCharacters,
String missingCharacters,
String matchCharacters,
String matchSequence)
Reads a line of sequence, skipping over any comments and filtering using sequenceType. |
String |
readToken()
Reads a token stopping when any whitespace or a comment is found. |
String |
readToken(String delimiters)
Reads a token stopping when any whitespace, a comment or when any character in delimiters is found. |
void |
setCommentDelimiters(char line)
|
void |
setCommentDelimiters(char start,
char stop)
|
void |
setCommentDelimiters(char start,
char stop,
char line)
|
void |
setCommentDelimiters(char start,
char stop,
char line,
char write,
char meta)
|
void |
setCommentWriter(Writer commentWriter)
|
void |
setExpectedInputLength(long l)
|
void |
skipCharacters(String skip)
Skips over any contiguous characters in skip. |
protected void |
skipComments(char delimiter)
Skips over any comments. |
void |
skipSpace()
Skips over any space (plus tabs and returns) in the file. |
void |
skipToEndOfLine()
Skips to the end of the line. |
char |
skipUntil(String skip)
Skips over the file until a character from delimiters is found. |
void |
skipWhile(String skip)
Skips char any contiguous characters in skip. |
void |
unreadCharacter(char ch)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ImportHelper(Reader reader)
reader
- public ImportHelper(Reader reader, Writer commentWriter)
Method Detail |
---|
public void setExpectedInputLength(long l)
public double getProgress()
public void closeReader() throws IOException
IOException
public void setCommentDelimiters(char line)
public void setCommentDelimiters(char start, char stop)
public void setCommentDelimiters(char start, char stop, char line)
public void setCommentDelimiters(char start, char stop, char line, char write, char meta)
public void setCommentWriter(Writer commentWriter)
public int getLineNumber()
public int getLastDelimiter()
public char nextCharacter() throws IOException
IOException
public char readCharacter() throws IOException
IOException
public void unreadCharacter(char ch)
public char next() throws IOException
IOException
public char read() throws IOException
IOException
public String readLine() throws IOException
IOException
public void readSequence(StringBuilder sequence, SequenceType sequenceType, String delimiters, int maxSites, String gapCharacters, String missingCharacters, String matchCharacters, String matchSequence) throws IOException, ImportException
IOException
ImportException
public void readSequence(StringBuilder sequence, SequenceType sequenceType, String delimiters, int maxSites, String gapCharacters, String missingCharacters, String matchCharacters, String matchSequence, ProgressListener progress) throws IOException, ImportException
sequence
- a StringBuffer into which the sequence is putsequenceType
- the sequenceType of the sequencedelimiters
- list of characters that will stop the readinggapCharacters
- list of characters that will be read as gapsmissingCharacters
- list of characters that will be read as missingmatchCharacters
- list of characters that will be read as matching the matchSequencematchSequence
- the sequence string to match match characters tomaxSites
- maximum number of sites to readprogress
- optional ProgressListener. May be null if not interested in progress
IOException
ImportException
public void readSequenceLine(StringBuffer sequence, SequenceType sequenceType, String delimiters, String gapCharacters, String missingCharacters, String matchCharacters, String matchSequence) throws IOException, ImportException
sequence
- a StringBuffer into which the sequence is putsequenceType
- the sequenceType of the sequencedelimiters
- list of characters that will stop the readinggapCharacters
- list of characters that will be read as gapsmissingCharacters
- list of characters that will be read as missingmatchCharacters
- list of characters that will be read as matching the matchSequencematchSequence
- the sequence string to match match characters to
IOException
ImportException
public int readInteger() throws IOException, ImportException
IOException
ImportException
public int readInteger(String delimiters) throws IOException, ImportException
IOException
ImportException
public double readDouble() throws IOException, ImportException
IOException
ImportException
public double readDouble(String delimiters) throws IOException, ImportException
IOException
ImportException
public String readToken() throws IOException
IOException
public String readToken(String delimiters) throws IOException
IOException
protected void skipComments(char delimiter) throws IOException
IOException
public void skipToEndOfLine() throws IOException
IOException
public void skipWhile(String skip) throws IOException
IOException
public void skipSpace() throws IOException
IOException
public void skipCharacters(String skip) throws IOException
IOException
public char skipUntil(String skip) throws IOException
IOException
public String getLastMetaComment()
public void clearLastMetaComment()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |