Package com.redwood.scheduler.api.rtx
Class RTXReader
- java.lang.Object
-
- com.redwood.scheduler.api.rtx.RTXReader
-
- All Implemented Interfaces:
RTXProducer
,Closeable
,AutoCloseable
,Iterable<RTXRow>
public class RTXReader extends Object implements RTXProducer
Reader for RTX format.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RTXReader.StrictMode
Control over how strictly the specification is interpreted.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
RTXMetadata
getMetadata()
int
getRowNumber()
RTXReader.StrictMode
getStrictMode()
boolean
hasNext()
Iterator<RTXRow>
iterator()
Iterator<RTXRow>
iterator(String... columns)
Return an iterator with a subset of columns.RTXRow
next()
Iterable<RTXRow>
rows()
Return anIterable
for rows from the current position on, this can only be used to retrieve a single iterator.Iterable<RTXRow>
rows(String... columns)
void
setStrictMode(RTXReader.StrictMode newStrictMode)
Sets theRTXReader.StrictMode
, that is, when this RTXProducer does support strictMode.boolean
supportsStrictMode(RTXReader.StrictMode newStrictMode)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
RTXReader
public RTXReader(InputStream newInputStream) throws RTXReaderException
- Throws:
RTXReaderException
-
RTXReader
public RTXReader(InputStream newInputStream, String... columns) throws RTXReaderException
- Throws:
RTXReaderException
-
RTXReader
public RTXReader(Reader newInputReader) throws RTXReaderException
- Throws:
RTXReaderException
-
RTXReader
public RTXReader(Reader newInputReader, String... columns) throws RTXReaderException
- Throws:
RTXReaderException
-
RTXReader
public RTXReader(String filename) throws FileNotFoundException, RTXReaderException, RTXMetadataRuntimeException
-
-
Method Detail
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceRTXProducer
-
getMetadata
public RTXMetadata getMetadata()
- Specified by:
getMetadata
in interfaceRTXProducer
- Returns:
- the metadata of the data, describing the column definitions and sources.
-
hasNext
public boolean hasNext() throws RTXReaderException
- Specified by:
hasNext
in interfaceRTXProducer
- Returns:
- true, when there is a next row, false otherwise
- Throws:
RTXReaderException
-
next
public RTXRow next() throws RTXReaderException
- Specified by:
next
in interfaceRTXProducer
- Returns:
- the next row.
- Throws:
RTXReaderException
-
getRowNumber
public int getRowNumber()
- Specified by:
getRowNumber
in interfaceRTXProducer
- Returns:
- the row-number of the current row. It starts with
0 and is increased by
RTXProducer.hasNext()
. The first row will have the row-number 1.
-
getStrictMode
public RTXReader.StrictMode getStrictMode()
- Specified by:
getStrictMode
in interfaceRTXProducer
-
setStrictMode
public void setStrictMode(RTXReader.StrictMode newStrictMode)
Description copied from interface:RTXProducer
Sets theRTXReader.StrictMode
, that is, when this RTXProducer does support strictMode.- Specified by:
setStrictMode
in interfaceRTXProducer
- Parameters:
newStrictMode
- the new mode
-
supportsStrictMode
public boolean supportsStrictMode(RTXReader.StrictMode newStrictMode)
- Specified by:
supportsStrictMode
in interfaceRTXProducer
-
iterator
public Iterator<RTXRow> iterator()
- Specified by:
iterator
in interfaceIterable<RTXRow>
- Specified by:
iterator
in interfaceRTXProducer
-
rows
public Iterable<RTXRow> rows(String... columns)
Description copied from interface:RTXProducer
Return anIterable
for rows from the current position on, with a subset of columns, this can only be used to retrieve a single iterator.- Specified by:
rows
in interfaceRTXProducer
- Parameters:
columns
- a list of columns- Returns:
- an
Iterable
with a subset of columns.
-
rows
public Iterable<RTXRow> rows()
Description copied from interface:RTXProducer
Return anIterable
for rows from the current position on, this can only be used to retrieve a single iterator.- Specified by:
rows
in interfaceRTXProducer
- Returns:
- an
Iterable
.
-
iterator
public Iterator<RTXRow> iterator(String... columns)
Description copied from interface:RTXProducer
Return an iterator with a subset of columns.- Specified by:
iterator
in interfaceRTXProducer
- Parameters:
columns
- a list of columns- Returns:
- an iterator with a subset of columns.
-
-