@InterfaceAudience.Public @InterfaceStability.Evolving public class StructIterator extends Object implements Iterator<Object>
Iterator over encoded Struct members.
This iterates over each serialized Struct field from the specified
DataTypes<?>[] definition. It allows you to read the field or skip
over its serialized bytes using next() and skip(),
respectively. This is in contrast to the Struct method which allow
you to Struct.decode(PositionedByteRange) or
Struct.skip(PositionedByteRange) over the entire Struct at
once.
This iterator may also be used to read bytes from any Struct for
which the specified DataType<?>[] is a prefix. For example, if the
specified Struct definition has a RawInteger and a
RawStringTerminated field, you may parse the serialized output
of a Struct whose fields are RawInteger,
RawStringTerminated, and RawBytes. The iterator would
return a number followed by a String. The trailing byte[]
would be ignored.
| Modifier and Type | Field and Description |
|---|---|
protected int |
idx |
protected PositionedByteRange |
src |
protected DataType[] |
types |
| Constructor and Description |
|---|
StructIterator(PositionedByteRange src,
DataType[] types)
Construct
StructIterator over the values encoded in src
using the specified types definition. |
protected final PositionedByteRange src
protected int idx
protected final DataType[] types
public StructIterator(PositionedByteRange src, DataType[] types)
StructIterator over the values encoded in src
using the specified types definition.src - The buffer from which to read encoded values.types - The sequence of types to use as the schema for this
Struct.Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.