public abstract class FeedSimTupleInputStream extends FeedSimCSVInputStream
This interface may be helpful for proprietary data formats where converting to CSV is relatively expensive when compared with using native data types and converting directly to a StreamBase tuple.
This class provides an implementation of the read() method declared in the superclass. However in 7.5.4 and beyond, the read() method is no longer used. The implementation here calls "readTuple()" and converts each Tuple to a sequence of "char"s in CSV format, with those chars yielded by "read()" one at a time. Though not used by FeedSim or the FeedSim editor in Studio, the "read()" method is provided as a convenience, if the equivalent CSV data is desired. In 7.5.4 and beyond, configuration of a FeedSim file that uses this kind of plugin is similar to a FeedSim file configuration via a CSV file that includes a header, however the "getSchema()" field names are used instead of the CSV header names. Also the column strings in a CSV file are replaced by the field values in the "readTuple()" results. Also, in 7.5.4, mapping to destination fields is required, and done by-name. Before 7.5.4, the read() method was still used in the FeedSim editor to display preview contents, etc. If the Timestamp builder was used, then the readTuple() method was not be called, and data was only delivered via the read() method. Also, before 7.5.4, by-name field to simulation field mapping was not supported: only by-index, when the index mappings were incrementing by 1, starting at 1 (1, 2, 3...) was supported.
Constructor and Description |
---|
FeedSimTupleInputStream(String path) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close that cleans up the default read() state
|
abstract Schema |
getSchema()
This method must return the Schema of the data to be returned by readTuple()
|
int |
read()
Provide a default implementation for the required read() method
that uses the readTuple implementation.
|
abstract Tuple |
readTuple()
This method is called by a FeedSim thread to get the next tuple to send.
|
getPath
available, mark, markSupported, read, read, reset, skip
public FeedSimTupleInputStream(String path) throws IOException
IOException
public abstract Schema getSchema() throws StreamBaseException
StreamBaseException
public abstract Tuple readTuple() throws StreamBaseException
StreamBaseException
public int read() throws IOException
read
in class InputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException