Package org.tribuo.json
Class JsonFileIterator
java.lang.Object
com.oracle.labs.mlrg.olcut.util.IOSpliterator<ColumnarIterator.Row>
org.tribuo.data.columnar.ColumnarIterator
org.tribuo.json.JsonFileIterator
- All Implemented Interfaces:
AutoCloseable
,Iterator<ColumnarIterator.Row>
,Spliterator<ColumnarIterator.Row>
An iterator for JSON format files converting them into a format suitable for
RowProcessor
.-
Nested Class Summary
Nested classes/interfaces inherited from class org.tribuo.data.columnar.ColumnarIterator
ColumnarIterator.Row
Nested classes/interfaces inherited from interface java.util.Spliterator
Spliterator.OfDouble, Spliterator.OfInt, Spliterator.OfLong, Spliterator.OfPrimitive<T extends Object,
T_CONS extends Object, T_SPLITR extends Spliterator.OfPrimitive<T, T_CONS, T_SPLITR>> -
Field Summary
Fields inherited from class org.tribuo.data.columnar.ColumnarIterator
currentRow, fields
Fields inherited from class com.oracle.labs.mlrg.olcut.util.IOSpliterator
DEFAULT_BATCH_SIZE, DEFAULT_CHARACTERISTICS
Fields inherited from interface java.util.Spliterator
CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED
-
Constructor Summary
ConstructorDescriptionJsonFileIterator
(Reader reader) Builds a JsonFileIterator for the supplied Reader.JsonFileIterator
(URI dataFile) Builds a CSVIterator for the supplied URI. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected Optional<ColumnarIterator.Row>
getRow()
Returns the next row of data based on internal state stored by the implementor, orOptional.empty()
if there is no more data.Methods inherited from class org.tribuo.data.columnar.ColumnarIterator
forEachRemaining, getFields, hasNext, next, tryAdvance
Methods inherited from class com.oracle.labs.mlrg.olcut.util.IOSpliterator
characteristics, estimateSize, trySplit
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Spliterator
getComparator, getExactSizeIfKnown, hasCharacteristics
-
Constructor Details
-
JsonFileIterator
Builds a JsonFileIterator for the supplied Reader.- Parameters:
reader
- The source to read.
-
JsonFileIterator
Builds a CSVIterator for the supplied URI.- Parameters:
dataFile
- The source to read.- Throws:
IOException
- thrown if the file is not readable in some way.
-
-
Method Details
-
getRow
Description copied from class:ColumnarIterator
Returns the next row of data based on internal state stored by the implementor, orOptional.empty()
if there is no more data.- Specified by:
getRow
in classColumnarIterator
- Returns:
- The next row of data or None.
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
IOException
-