public class FormattedInput
tools to simplify formatted input from an input stream
public static FormattedInput getInstance()
create new instance of this object (note that there is no public constructor because this class is a singleton!)
public void nextLine(java.io.PushbackReader in)
go to the beginning of the next line. Recognized line terminators: Unix: \n, DOS: \r\n, Macintosh: \r
in - input streampublic java.lang.String readLine(java.io.PushbackReader in,
boolean keepWhiteSpace)
read a whole line
in - input streamkeepWhiteSpace - keep or drop white spacepublic int skipWhiteSpace(java.io.PushbackReader in)
go to first non-whitespace character
in - input streampublic int readNextChar(java.io.PushbackReader input)
read next character from stream (EOF does not count as character but will throw exception)
input - input streampublic java.lang.String readWord(java.io.PushbackReader in)
read word from stream
public java.lang.String readLabel(java.io.PushbackReader in,
int maxLength)
read sequence label from stream A sequence label is not allowed to contain whitespace and either of :,;()[]{}. Note that newline/cr is NOT counted as white space!!
in - input streammaxLength - maximum allowed length of label (if negative any length is permitted)public java.lang.String readNumber(java.io.PushbackReader in,
boolean ignoreNewlineCR)
public double readDouble(java.io.PushbackReader in)
read next number from stream and convert it to a double (newline/cr are treated as separators)
in - input streampublic double readDouble(java.io.PushbackReader in,
boolean ignoreNewlineCR)
read next number from stream and convert it to a double
in - input streamignoreNewlineCR - ignore newline/cr as separatorpublic int readInt(java.io.PushbackReader in)
read next number from stream and convert it to a int (newline/cr are treated as separators)
in - input streampublic int readInt(java.io.PushbackReader in,
boolean ignoreNewlineCR)
read next number from stream and convert it to a int
in - input streamignoreNewlineCR - ignore newline/cr as separator