Top Inners Fields Constructors Methods
com.amazon.ion.impl

pack-priv Class IonReaderTreeSystem

extends Object
implements IonReader, _Private_ReaderWriter
Class Inheritance
All Implemented Interfaces
com.amazon.ion.impl._Private_ReaderWriter, com.amazon.ion.IonReader, com.amazon.ion.facet.Faceted, java.io.Closeable, java.lang.AutoCloseable
Known Direct Subclasses
com.amazon.ion.impl.IonReaderTreeUserX
Static Imports
com.amazon.ion.impl._Private_Utils.readFully

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
protected _Private_IonValue
protected boolean
protected Iterator<IonValue>
protected _Private_IonValue
protected IonValue
private Object[]
_stack

Holds pairs: IonValue parent, Iterator<ionvalue> cursor

private final _Private_IonValue.SymbolTableProvider
protected final SymbolTable
protected int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public <T> T

Returns:

This implementation always returns null.
asFacet
(Class<T>
The type token of the requested facet type.
facetType
)

Implements com.amazon.ion.facet.Faceted.asFacet.

Returns a facet of this subject if supported.

public BigDecimal
bigDecimalValue()

Implements com.amazon.ion.IonReader.bigDecimalValue.

Returns the current value as a BigDecimal.

public BigInteger
bigIntegerValue()

Implements com.amazon.ion.IonReader.bigIntegerValue.

Returns the current value as a BigInteger.

public boolean
booleanValue()

Implements com.amazon.ion.IonReader.booleanValue.

Returns the current value as an boolean.

public int
byteSize()

Implements com.amazon.ion.IonReader.byteSize.

Gets the size in bytes of the current lob value.

public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.

public Date
dateValue()

Implements com.amazon.ion.IonReader.dateValue.

Returns the current value as a java.util.Date.

public Decimal
decimalValue()

Implements com.amazon.ion.IonReader.decimalValue.

Returns the current value as a Decimal, which extends BigDecimal with support for negative zeros.

public double
doubleValue()

Implements com.amazon.ion.IonReader.doubleValue.

Returns the current value as a double.

public int
getBytes(byte[]
destination to copy the value into, this must not be null.
buffer
,
int
the first position to copy into, this must be non null and less than the length of buffer.
offset
,
int
the number of bytes available in the buffer to copy into, this must be long enough to hold the whole value and not extend outside of buffer.
len
)

Implements com.amazon.ion.IonReader.getBytes.

Copies the current value into the passed in a byte array.

public final int
getDepth()

Implements com.amazon.ion.IonReader.getDepth.

Returns the depth into the Ion value that this reader has traversed.

public int
getFieldId()

Implements com.amazon.ion.IonReader.getFieldId.

/** Gets the symbol ID of the field name attached to the current value.

public String
getFieldName()

Implements com.amazon.ion.IonReader.getFieldName.

Return the field name of the current value.

public final SymbolToken
getFieldNameSymbol()

Implements com.amazon.ion.IonReader.getFieldNameSymbol.

Gets the current value's field name as a symbol token (text + ID).

public IntegerSize
getIntegerSize()

Implements com.amazon.ion.IonReader.getIntegerSize.

Returns an IntegerSize representing the smallest-possible Java type of the Ion int at the current value.

public IonValue
public SymbolTable
getSymbolTable()

Implements com.amazon.ion.IonReader.getSymbolTable.

Returns the symbol table that is applicable to the current value.

public IonType
getType()

Implements com.amazon.ion.IonReader.getType.

Returns the type of the current value, or null if there is no current value.

public final String[]
getTypeAnnotations()

Implements com.amazon.ion.IonReader.getTypeAnnotations.

Return the annotations of the current value as an array of strings.

public final SymbolToken[]
getTypeAnnotationSymbols()

Implements com.amazon.ion.IonReader.getTypeAnnotationSymbols.

Gets the current value's annotations as symbol tokens (text + ID).

public boolean
hasNext()

Implements com.amazon.ion.IonReader.hasNext.

Determines whether there is another value at the current depth; in other words whether there is a sibling value that may be reached using next().

public int
intValue()

Implements com.amazon.ion.IonReader.intValue.

Returns the current value as an int.

public boolean
isInStruct()

Implements com.amazon.ion.IonReader.isInStruct.

Determines whether this reader is currently traversing the fields of an Ion struct.

public boolean
isNullValue()

Implements com.amazon.ion.IonReader.isNullValue.

Determines whether the current value is a null Ion value of any type (for example, null or null.int).

public final Iterator<String>
iterateTypeAnnotations()

Implements com.amazon.ion.IonReader.iterateTypeAnnotations.

Return the annotations on the curent value as an iterator.

public long
longValue()

Implements com.amazon.ion.IonReader.longValue.

Returns the current value as a long.

public byte[]
newBytes()

Implements com.amazon.ion.IonReader.newBytes.

Returns the current value as a newly-allocated byte array.

public IonType
next()

Implements com.amazon.ion.IonReader.next.

Positions this reader on the next sibling after the current value, returning the type of that value.

pack-priv IonType
private void
pop()

public SymbolTable
private void
push()

pack-priv void
re_init(IonValue value, boolean hoisted)

public final void
stepIn()

Implements com.amazon.ion.IonReader.stepIn.

Positions the reader just before the contents of the current value, which must be a container (list, sexp, or struct).

public final void
stepOut()

Implements com.amazon.ion.IonReader.stepOut.

Positions the iterator after the current parent's value, moving up one level in the data hierarchy.

public String
stringValue()

Implements com.amazon.ion.IonReader.stringValue.

Returns the current value as a Java String.

public SymbolToken
symbolValue()

Implements com.amazon.ion.IonReader.symbolValue.

Returns the current value as a symbol token (text + ID).

public Timestamp
timestampValue()

Implements com.amazon.ion.IonReader.timestampValue.

Returns the current value as a Timestamp.

public String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_currback to summary
protected _Private_IonValue _curr
_eofback to summary
protected boolean _eof
_iterback to summary
protected Iterator<IonValue> _iter
_nextback to summary
protected _Private_IonValue _next
_parentback to summary
protected IonValue _parent
_stackback to summary
private Object[] _stack

Holds pairs: IonValue parent, Iterator cursor

_symbolTableAccessorback to summary
private final _Private_IonValue.SymbolTableProvider _symbolTableAccessor
_system_symtabback to summary
protected final SymbolTable _system_symtab
_topback to summary
protected int _top

Constructor Detail

IonReaderTreeSystemback to summary
public IonReaderTreeSystem(IonValue value)

Method Detail

asFacetback to summary
public <T> T asFacet(Class<T> facetType)

Implements com.amazon.ion.facet.Faceted.asFacet.

Doc from com.amazon.ion.facet.Faceted.asFacet.

Returns a facet of this subject if supported.

Parameters
<T>
The requested facet type.
facetType:Class<T>

The type token of the requested facet type.

Returns:T

This implementation always returns null.

bigDecimalValueback to summary
public BigDecimal bigDecimalValue()

Implements com.amazon.ion.IonReader.bigDecimalValue.

Doc from com.amazon.ion.IonReader.bigDecimalValue.

Returns the current value as a BigDecimal. This method should not return a Decimal, so it lacks support for negative zeros.

This method is only valid when getType() returns IonType#DECIMAL.

Returns:BigDecimal

the current value as a BigDecimal, or null if the current value is null.decimal.

bigIntegerValueback to summary
public BigInteger bigIntegerValue()

Implements com.amazon.ion.IonReader.bigIntegerValue.

Doc from com.amazon.ion.IonReader.bigIntegerValue.

Returns the current value as a BigInteger. This is only valid if there is an underlying value and the value is of type int or float.

booleanValueback to summary
public boolean booleanValue()

Implements com.amazon.ion.IonReader.booleanValue.

Doc from com.amazon.ion.IonReader.booleanValue.

Returns the current value as an boolean. This is only valid when getType() returns IonType#BOOL.

byteSizeback to summary
public int byteSize()

Implements com.amazon.ion.IonReader.byteSize.

Doc from com.amazon.ion.IonReader.byteSize.

Gets the size in bytes of the current lob value. This is only valid when getType() returns IonType#BLOB or IonType#CLOB.

Returns:int

the lob's size in bytes.

closeback to summary
public void close()

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

dateValueback to summary
public Date dateValue()

Implements com.amazon.ion.IonReader.dateValue.

Doc from com.amazon.ion.IonReader.dateValue.

Returns the current value as a java.util.Date. This is only valid when getType() returns IonType#TIMESTAMP.

Returns:Date

the current value as a Date, or null if the current value is null.timestamp.

decimalValueback to summary
public Decimal decimalValue()

Implements com.amazon.ion.IonReader.decimalValue.

Doc from com.amazon.ion.IonReader.decimalValue.

Returns the current value as a Decimal, which extends BigDecimal with support for negative zeros. This is only valid when getType() returns IonType#DECIMAL.

Returns:Decimal

the current value as a Decimal, or null if the current value is null.decimal.

doubleValueback to summary
public double doubleValue()

Implements com.amazon.ion.IonReader.doubleValue.

Doc from com.amazon.ion.IonReader.doubleValue.

Returns the current value as a double. This is only valid if there is an underlying value and the value is either float, or decimal.

getBytesback to summary
public int getBytes(byte[] buffer, int offset, int len)

Implements com.amazon.ion.IonReader.getBytes.

Doc from com.amazon.ion.IonReader.getBytes.

Copies the current value into the passed in a byte array. This is only valid when getType() returns IonType#BLOB or IonType#CLOB.

Parameters
buffer:byte[]

destination to copy the value into, this must not be null.

offset:int

the first position to copy into, this must be non null and less than the length of buffer.

len:int

the number of bytes available in the buffer to copy into, this must be long enough to hold the whole value and not extend outside of buffer.

getDepthback to summary
public final int getDepth()

Implements com.amazon.ion.IonReader.getDepth.

Doc from com.amazon.ion.IonReader.getDepth.

Returns the depth into the Ion value that this reader has traversed. At top level the depth is 0, and it increases by one on each call to stepIn().

getFieldIdback to summary
public int getFieldId()

Implements com.amazon.ion.IonReader.getFieldId.

Doc from com.amazon.ion.IonReader.getFieldId.

/** Gets the symbol ID of the field name attached to the current value.

This is an "expert method": correct use requires deep understanding of the Ion binary format. You almost certainly don't want to use it.

Returns:int

the symbol ID of the field name, if the current value is a field within a struct. If the current value is not a field, or if the symbol ID cannot be determined, this method returns a value less than one.

getFieldNameback to summary
public String getFieldName()

Implements com.amazon.ion.IonReader.getFieldName.

Doc from com.amazon.ion.IonReader.getFieldName.

Return the field name of the current value. Or null if there is no valid current value or if the current value is not a field of a struct.

getFieldNameSymbolback to summary
public final SymbolToken getFieldNameSymbol()

Implements com.amazon.ion.IonReader.getFieldNameSymbol.

Doc from com.amazon.ion.IonReader.getFieldNameSymbol.

Gets the current value's field name as a symbol token (text + ID). If the text of the token isn't known, the result's SymbolToken#getText() will be null. If the symbol ID of the token isn't known, the result's SymbolToken#getSid() will be SymbolTable#UNKNOWN_SYMBOL_ID. At least one of the two fields will be defined.

Returns:SymbolToken

null if there is no current value or if the current value is not a field of a struct.

getIntegerSizeback to summary
public IntegerSize getIntegerSize()

Implements com.amazon.ion.IonReader.getIntegerSize.

Doc from com.amazon.ion.IonReader.getIntegerSize.

Returns an IntegerSize representing the smallest-possible Java type of the Ion int at the current value. If the current value is null.int or is not an Ion int, or if there is no current value, null will be returned.

getIonValueback to summary
public IonValue getIonValue(IonSystem sys)
getSymbolTableback to summary
public SymbolTable getSymbolTable()

Implements com.amazon.ion.IonReader.getSymbolTable.

Doc from com.amazon.ion.IonReader.getSymbolTable.

Returns the symbol table that is applicable to the current value. This may be either a system or local symbol table.

getTypeback to summary
public IonType getType()

Implements com.amazon.ion.IonReader.getType.

Doc from com.amazon.ion.IonReader.getType.

Returns the type of the current value, or null if there is no current value.

getTypeAnnotationsback to summary
public final String[] getTypeAnnotations()

Implements com.amazon.ion.IonReader.getTypeAnnotations.

Doc from com.amazon.ion.IonReader.getTypeAnnotations.

Return the annotations of the current value as an array of strings.

Returns:String[]

the (ordered) annotations on the current value, or an empty array (not null) if there are none.

getTypeAnnotationSymbolsback to summary
public final SymbolToken[] getTypeAnnotationSymbols()

Implements com.amazon.ion.IonReader.getTypeAnnotationSymbols.

Doc from com.amazon.ion.IonReader.getTypeAnnotationSymbols.

Gets the current value's annotations as symbol tokens (text + ID).

Returns:SymbolToken[]

the (ordered) annotations on the current value, or an empty array (not null) if there are none.

hasNextback to summary
public boolean hasNext()

Implements com.amazon.ion.IonReader.hasNext.

Doc from com.amazon.ion.IonReader.hasNext.

Determines whether there is another value at the current depth; in other words whether there is a sibling value that may be reached using next(). This method may be called multiple times, which does not move the current position.

Warning

this method alters the internal state of the reader such that you cannot reliably get values from the "current" element. The only thing you should call after hasNext() is next()!

intValueback to summary
public int intValue()

Implements com.amazon.ion.IonReader.intValue.

Doc from com.amazon.ion.IonReader.intValue.

Returns the current value as an int. This is only valid if there is an underlying value and the value is of a numeric type (int, float, or decimal).

isInStructback to summary
public boolean isInStruct()

Implements com.amazon.ion.IonReader.isInStruct.

Doc from com.amazon.ion.IonReader.isInStruct.

Determines whether this reader is currently traversing the fields of an Ion struct. It returns false if the iteration is in a list, a sexp, or a datagram.

isNullValueback to summary
public boolean isNullValue()

Implements com.amazon.ion.IonReader.isNullValue.

Doc from com.amazon.ion.IonReader.isNullValue.

Determines whether the current value is a null Ion value of any type (for example, null or null.int). It should be called before calling getters that return value types (int, long, boolean, double).

iterateTypeAnnotationsback to summary
public final Iterator<String> iterateTypeAnnotations()

Implements com.amazon.ion.IonReader.iterateTypeAnnotations.

Doc from com.amazon.ion.IonReader.iterateTypeAnnotations.

Return the annotations on the curent value as an iterator. The iterator is empty (hasNext() returns false on the first call) if there are no annotations on the current value.

Implementations *may* throw UnknownSymbolException from this method if any annotation contains unknown text. Alternatively, implementations may provide an Iterator that throws UnknownSymbolException only when the user navigates the iterator to an annotation with unknown text.

Note

the iterator returned by this method is only valid while the reader remains positioned on the current value (i.e., before next, step in, or step out). Use cases that require storing a value's annotations after advancing past that value should either copy them from the iterator or call getTypeAnnotations().

Returns:Iterator<String>

not null.

longValueback to summary
public long longValue()

Implements com.amazon.ion.IonReader.longValue.

Doc from com.amazon.ion.IonReader.longValue.

Returns the current value as a long. This is only valid if there is an underlying value and the value is of a numeric type (int, float, or decimal).

newBytesback to summary
public byte[] newBytes()

Implements com.amazon.ion.IonReader.newBytes.

Doc from com.amazon.ion.IonReader.newBytes.

Returns the current value as a newly-allocated byte array. This is only valid when getType() returns IonType#BLOB or IonType#CLOB.

nextback to summary
public IonType next()

Implements com.amazon.ion.IonReader.next.

Doc from com.amazon.ion.IonReader.next.

Positions this reader on the next sibling after the current value, returning the type of that value. Once so positioned the contents of this value can be accessed with the *Value() methods.

A sequence of next() calls traverses the data at a constant depth, within the same container. Use stepIn() to traverse down into any containers, and stepOut() to traverse up to the parent container.

Returns:IonType

the type of the next Ion value (never IonType#DATAGRAM), or null when there are no more elements at the current depth in the same container.

next_helper_systemback to summary
pack-priv IonType next_helper_system()
popback to summary
private void pop()
Annotations
@SuppressWarnings:unchecked
pop_passed_symbol_tableback to summary
public SymbolTable pop_passed_symbol_table()

Implements com.amazon.ion.impl._Private_ReaderWriter.pop_passed_symbol_table.

pushback to summary
private void push()
re_initback to summary
pack-priv void re_init(IonValue value, boolean hoisted)
stepInback to summary
public final void stepIn()

Implements com.amazon.ion.IonReader.stepIn.

Doc from com.amazon.ion.IonReader.stepIn.

Positions the reader just before the contents of the current value, which must be a container (list, sexp, or struct). There's no current value immediately after stepping in, so the next thing you'll want to do is call next() to move onto the first child value (or learn that there's not one).

Stepping into a null container (null.list, null.sexp, or null.struct) behaves as if the container were empty ([], (), or {}).

At any time stepOut() may be called to move the cursor back to (just after) the parent value, even if there's more children remaining.

stepOutback to summary
public final void stepOut()

Implements com.amazon.ion.IonReader.stepOut.

Doc from com.amazon.ion.IonReader.stepOut.

Positions the iterator after the current parent's value, moving up one level in the data hierarchy. There's no current value immediately after stepping out, so the next thing you'll want to do is call next() to move onto the following value.

stringValueback to summary
public String stringValue()

Implements com.amazon.ion.IonReader.stringValue.

Doc from com.amazon.ion.IonReader.stringValue.

Returns the current value as a Java String. This is only valid when getType() returns IonType#STRING or IonType#SYMBOL.

symbolValueback to summary
public SymbolToken symbolValue()

Implements com.amazon.ion.IonReader.symbolValue.

Doc from com.amazon.ion.IonReader.symbolValue.

Returns the current value as a symbol token (text + ID). This is only valid when getType() returns IonType#SYMBOL.

Returns:SymbolToken

null if isNullValue()

timestampValueback to summary
public Timestamp timestampValue()

Implements com.amazon.ion.IonReader.timestampValue.

Doc from com.amazon.ion.IonReader.timestampValue.

Returns the current value as a Timestamp. This is only valid when getType() returns IonType#TIMESTAMP.

Returns:Timestamp

the current value as a Timestamp, or null if the current value is null.timestamp.

valueToStringback to summary
public String valueToString()
com.amazon.ion.impl back to summary

private final Class IonReaderTreeSystem.Children

extends Object
implements Iterator<IonValue>
Class Inheritance
All Implemented Interfaces
java.util.Iterator

Field Summary

Modifier and TypeField and Description
pack-priv IonValue
pack-priv boolean
pack-priv int
pack-priv _Private_IonContainer

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

public IonValue
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_currback to summary
pack-priv IonValue _curr
_eofback to summary
pack-priv boolean _eof
_next_idxback to summary
pack-priv int _next_idx
_parentback to summary
pack-priv _Private_IonContainer _parent

Constructor Detail

Childrenback to summary
pack-priv Children(IonContainer parent)

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

nextback to summary
public IonValue next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:IonValue

the next element in the iteration

removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.