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.Matcher
comment
Comment pattern.protected Tokenizer
tokenizer
String 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 void
close()
Tokenizer
getTokenizer()
Get the tokenizer of the reader.boolean
nextLine()
Read the next line.boolean
nextLineExceptComments()
Read the next line into the tokenizer.void
reset()
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.IOException
Read the next line into the tokenizer.- Returns:
- The next line, or
null
. - Throws:
java.io.IOException
-
nextLine
public boolean nextLine() throws java.io.IOException
Description copied from class:BufferedLineReader
Read the next line.- Overrides:
nextLine
in classBufferedLineReader
- Returns:
true
if 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:
reset
in classBufferedLineReader
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Overrides:
close
in classBufferedLineReader
- Throws:
java.io.IOException
-
getTokenizer
public Tokenizer getTokenizer()
Get the tokenizer of the reader.- Returns:
- Tokenizer
-
-