public abstract class AbstractStreamingParser extends AbstractParser implements StreamingParser
BufferedReader
, which recycles
the string builder.AbstractParser.Parameterizer
BundleStreamSource.Event
Modifier and Type | Field and Description |
---|---|
private StringBuilder |
buf
The buffer we read the data into.
|
private int |
lineNumber
Current line number.
|
private LineReader |
reader
Line reader.
|
ATTRIBUTE_CONCATENATION, COMMENT_PATTERN, DEFAULT_SEPARATOR, NUMBER_PATTERN, QUOTE_CHARS, tokenizer
Constructor and Description |
---|
AbstractStreamingParser(Pattern colSep,
String quoteChars,
Pattern comment)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
MultipleObjectsBundle |
asMultipleObjectsBundle()
Return (or collect) the stream as bundle.
|
boolean |
assignDBID(DBIDVar var)
Assign the current object ID to a
DBIDVar . |
void |
cleanup()
Cleanup internal data structures.
|
protected int |
getLineNumber()
Get the current line number.
|
boolean |
hasDBIDs()
Indicate whether the stream contains DBIDs.
|
void |
initStream(InputStream in)
Init the streaming parser for the given input stream.
|
protected boolean |
nextLineExceptComments()
Read the next line into the tokenizer.
|
MultipleObjectsBundle |
parse(InputStream in)
Returns a list of the objects parsed from the specified input stream.
|
getLogger, isComment, lengthWithoutLinefeed, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
data, getMeta, nextEvent
private LineReader reader
private StringBuilder buf
private int lineNumber
public final MultipleObjectsBundle parse(InputStream in)
Parser
public void initStream(InputStream in)
StreamingParser
initStream
in interface StreamingParser
in
- the stream to parse objects fromprotected int getLineNumber()
public boolean hasDBIDs()
BundleStreamSource
hasDBIDs
in interface BundleStreamSource
true
if the stream contains DBIDs.public boolean assignDBID(DBIDVar var)
BundleStreamSource
DBIDVar
.assignDBID
in interface BundleStreamSource
var
- Variable to assign the object id tofalse
when no object id is availableprotected boolean nextLineExceptComments() throws IOException
null
.IOException
public void cleanup()
AbstractParser
cleanup
in interface Parser
cleanup
in class AbstractParser
public MultipleObjectsBundle asMultipleObjectsBundle()
BundleStreamSource
asMultipleObjectsBundle
in interface BundleStreamSource
Copyright © 2014 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.