public class TSVParser extends DataStreamParser
The class extends the abstract class DataStreamParser and implements initTokenizer with suitable values for TSV files to provide this functionality.
The class (indirectly through DataStreamParser) implements the java.util.Iterator interface for convenience. This allows simple use in a Velocity template for example:
#foreach ($row in $tsvfile) Name: $row.Name Description: $row.Description #end
log
Constructor and Description |
---|
TSVParser(Reader in)
Create a new TSVParser instance.
|
TSVParser(Reader in,
List<String> columnNames)
Create a new TSVParser instance.
|
TSVParser(Reader in,
List<String> columnNames,
String characterEncoding)
Create a new TSVParser instance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
initTokenizer(StreamTokenizer tokenizer)
Initialize the StreamTokenizer instance used to read the lines
from the input reader.
|
enableLogging, hasNext, hasNextRow, next, nextRow, readColumnNames, remove, setColumnNames
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
public TSVParser(Reader in)
in
- the input reader.public TSVParser(Reader in, List<String> columnNames)
in
- the input reader.columnNames
- a list of column names.public TSVParser(Reader in, List<String> columnNames, String characterEncoding)
in
- the input reader.columnNames
- a list of column names.characterEncoding
- the character encoding of the input.protected void initTokenizer(StreamTokenizer tokenizer)
initTokenizer
in class DataStreamParser
tokenizer
- the stream tokenizer to be usedCopyright © 2005–2019 The Apache Software Foundation. All rights reserved.