Returns the annotations for the current value.
the empty array if the there are no annotations or the reader is not positioned on a value.
Returns the current value as a BigInt
. This is only valid if type() == IonTypes.INT
.
null
if the current Ion value isNull or a BigInt containing the deserialized integer.
Returns the current value as a boolean
. This is only valid if type() == IonTypes.BOOL
.
null
if the current Ion value isNull.
Returns the depth of the reader. This is 0
if the reader is not inside of a container.
Returns the field name of the current value.
null
if the reader is not positioned on a value or is on a value that has no field name.
Indicates whether the current int value is small enough to be stored in a number without loss of precision or if a BigInt is required.
IntSize.Number if the value will fit in a number, IntSize.BigInt otherwise.
Returns true if and only if the reader is positioned on a null
value of any type.
Returns the current value as a number
. This is only valid if type() == IonTypes.INT
or type() == IonTypes.FLOAT
.
null
if the current Ion value isNull. For int
values that are outside of
the range specified by Number.MIN_SAFE_INTEGER
and Number.MAX_SAFE_INTEGER
, this method
will truncate the result.
Returns the Reader's offset from the beginning of its input.
For binary Readers, the return value is the number of bytes that have been processed.
For text Readers, the return value is the number of UTF-16 code units that have been processed, regardless of the input's original encoding. For more on JavaScript's in-memory representation of text, see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length#Description
Note that a Reader cannot safely skip to a given position in input without processing the stream leading up to that position. This is because there are mid-stream system level values that must be processed to guarantee that the Reader is in a valid state. It is safe, however, to start at the beginning of a data source and call next() until you reach the desired position, as the reader will still have the opportunity to process system-level values along the way.
the number of bytes or UTF-16 code units that the reader has processed.
Steps into the container the reader is currently positioned on. Note that this positions the reader before the first value within the container.
Steps out of the current container. This is only valid when the reader is inside of a container
(i.e. depth() > 0
). Note that the positions the reader after the container that was
stepped out of, but before the next value after the container. One should generally
call next after invoking this method.
Returns the current value as a string
. This is only valid if type() == IonTypes.STRING
or type() == IonTypes.SYMBOL
.
null
if the current Ion value isNull.
Returns the current value as a Uint8Array
. This is only valid if type() == IonTypes.CLOB
or type() == IonTypes.BLOB
.
null
if the current Ion value isNull.
Returns the current scalar value. This is only valid when type().scalar == true
.
null
if the current value is isNull, equivalent to the corresponding xxxValue
methods
for all scalar types.
A pull parser interface over Ion data.
Generally, users will use next and stepIn and stepOut to traverse the structure of the data. The Value suffixed methods are used to extract the scalar data out of the current position of the Reader.
Reader instances start before a value, thus you have to invoke next to position a newly created reader on the first value.