Class FeedSimTupleInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
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.
- Since:
- 6.5.8
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close that cleans up the default read() stateabstract Schema
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
This method is called by a FeedSim thread to get the next tuple to send.Methods inherited from class com.streambase.sb.feedsim.FeedSimCSVInputStream
getPath
Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
FeedSimTupleInputStream
Constructor- Parameters:
path
- - path of the file to open- Throws:
IOException
- I/O error
-
-
Method Details
-
getSchema
This method must return the Schema of the data to be returned by readTuple()- Returns:
- The Schema of the data to be returned by readTuple()
- Throws:
StreamBaseException
- Error accessing schema
-
readTuple
This method is called by a FeedSim thread to get the next tuple to send. A null returned means end of data.- Returns:
- Next Tuple to be sent to the FeedSim Stream
- Throws:
StreamBaseException
- Error reading tuple
-
read
Provide a default implementation for the required read() method that uses the readTuple implementation.- Specified by:
read
in classInputStream
- Returns:
- the next character in the CSV representation of the input
- Throws:
IOException
- Since:
- 7.4
-
close
Close that cleans up the default read() state- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
- Since:
- 7.4
-