Package elki.datasource.parser
Class AbstractStreamingParser
- java.lang.Object
-
- elki.datasource.parser.AbstractStreamingParser
-
- All Implemented Interfaces:
BundleStreamSource
,Parser
,StreamingParser
- Direct Known Subclasses:
ClusteringVectorParser
,NumberVectorLabelParser
,SimplePolygonParser
,SimpleTransactionParser
public abstract class AbstractStreamingParser extends java.lang.Object implements StreamingParser
Base class for streaming parsers.- Since:
- 0.5.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractStreamingParser.Par
Parameterization class.-
Nested classes/interfaces inherited from interface elki.datasource.bundle.BundleStreamSource
BundleStreamSource.Event
-
-
Field Summary
Fields Modifier and Type Field Description protected TokenizedReader
reader
Tokenized reader.protected Tokenizer
tokenizer
Tokenizer.
-
Constructor Summary
Constructors Constructor Description AbstractStreamingParser(CSVReaderFormat format)
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description MultipleObjectsBundle
asMultipleObjectsBundle()
Return (or collect) the stream as bundle.boolean
assignDBID(DBIDVar var)
Assign the current object ID to aDBIDVar
.void
cleanup()
Perform cleanup operations after parsing.protected abstract Logging
getLogger()
Get the logger for this class.boolean
hasDBIDs()
Indicate whether the stream contains DBIDs.void
initStream(java.io.InputStream in)
Init the streaming parser for the given input stream.MultipleObjectsBundle
parse(java.io.InputStream in)
Returns a list of the objects parsed from the specified input stream.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface elki.datasource.bundle.BundleStreamSource
data, getMeta, nextEvent
-
-
-
-
Field Detail
-
reader
protected TokenizedReader reader
Tokenized reader.
-
tokenizer
protected Tokenizer tokenizer
Tokenizer.
-
-
Constructor Detail
-
AbstractStreamingParser
public AbstractStreamingParser(CSVReaderFormat format)
Constructor.- Parameters:
format
- Reader format
-
-
Method Detail
-
parse
public final MultipleObjectsBundle parse(java.io.InputStream in)
Description copied from interface:Parser
Returns a list of the objects parsed from the specified input stream.
-
initStream
public void initStream(java.io.InputStream in)
Description copied from interface:StreamingParser
Init the streaming parser for the given input stream.- Specified by:
initStream
in interfaceStreamingParser
- Parameters:
in
- the stream to parse objects from
-
hasDBIDs
public boolean hasDBIDs()
Description copied from interface:BundleStreamSource
Indicate whether the stream contains DBIDs.- Specified by:
hasDBIDs
in interfaceBundleStreamSource
- Returns:
true
if the stream contains DBIDs.
-
assignDBID
public boolean assignDBID(DBIDVar var)
Description copied from interface:BundleStreamSource
Assign the current object ID to aDBIDVar
.- Specified by:
assignDBID
in interfaceBundleStreamSource
- Parameters:
var
- Variable to assign the object id to- Returns:
false
when no object id is available
-
asMultipleObjectsBundle
public MultipleObjectsBundle asMultipleObjectsBundle()
Description copied from interface:BundleStreamSource
Return (or collect) the stream as bundle.- Specified by:
asMultipleObjectsBundle
in interfaceBundleStreamSource
- Returns:
- Bundle
-
cleanup
public void cleanup()
Description copied from interface:Parser
Perform cleanup operations after parsing.
-
getLogger
protected abstract Logging getLogger()
Get the logger for this class.- Returns:
- Logger.
-
-