Package elki.utilities.io
Class TokenizedReader
- java.lang.Object
-
- elki.utilities.io.BufferedLineReader
-
- elki.utilities.io.TokenizedReader
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class TokenizedReader extends BufferedLineReader
Reader that will tokenize the input data as desired.- Since:
- 0.7.0
- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.regex.MatchercommentComment pattern.protected TokenizertokenizerString tokenizer.-
Fields inherited from class elki.utilities.io.BufferedLineReader
buf, lineNumber
-
-
Constructor Summary
Constructors Constructor Description TokenizedReader(java.util.regex.Pattern colSep, java.lang.String quoteChars, java.util.regex.Pattern comment)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()TokenizergetTokenizer()Get the tokenizer of the reader.booleannextLine()Read the next line.booleannextLineExceptComments()Read the next line into the tokenizer.voidreset()Cleanup the internal state of the tokenized reader.-
Methods inherited from class elki.utilities.io.BufferedLineReader
getBuffer, getLineNumber, lengthWithoutLinefeed, reset, reset, reset
-
-
-
-
Field Detail
-
comment
private java.util.regex.Matcher comment
Comment pattern.
-
tokenizer
protected Tokenizer tokenizer
String tokenizer.
-
-
Method Detail
-
nextLineExceptComments
public boolean nextLineExceptComments() throws java.io.IOExceptionRead the next line into the tokenizer.- Returns:
- The next line, or
null. - Throws:
java.io.IOException
-
nextLine
public boolean nextLine() throws java.io.IOExceptionDescription copied from class:BufferedLineReaderRead the next line.- Overrides:
nextLinein classBufferedLineReader- Returns:
trueif another line was read successfully.- Throws:
java.io.IOException- on IO errors.
-
reset
public void reset()
Cleanup the internal state of the tokenized reader.This also closes the input stream, but the TokenizerReader can still be applied to a new stream using any of the
reset()methods.- Overrides:
resetin classBufferedLineReader
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Overrides:
closein classBufferedLineReader- Throws:
java.io.IOException
-
getTokenizer
public Tokenizer getTokenizer()
Get the tokenizer of the reader.- Returns:
- Tokenizer
-
-