Streaming Datasets
StreamingDataSet consumes a producer and exposes its content as a dataset. Provides cursor like forward only access to it and only keeps the active row in memory. Can be used with FlatXmlProducer and XmlProvider.
This is a very efficient way to load XML dataset document when working with forward only database operations (UPDATE, INSERT, REFRESH).
Following sample shows how to load a flat XML dataset with the StreamingDataSet:
IDataSetProducer producer = new FlatXmlProducer(new InputSource("dataset.xml"));
IDataSet dataSet = new StreamingDataSet(producer);Supporting Classes
org.dbunit.dataset.stream also has the plumbing behind producer/consumer
based access:
DataSetProducerAdapter
adapts an existing IDataSet/ITableIterator into an IDataSetProducer
(the opposite direction — useful when exporting/writing rather than
reading), and
BufferedConsumer
is an IDataSetConsumer that buffers all data until the dataset ends,
enabling columns discovered partway through (column sensing, see
Flat XML) to be appended after rows using them were
already produced.


