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

pack-priv final Class IonReaderNonContinuableSystem

extends Object
implements IonReader
Class Inheritance
All Implemented Interfaces
com.amazon.ion.IonReader, com.amazon.ion.facet.Faceted, java.io.Closeable, java.lang.AutoCloseable
Imports
com.amazon.ion.Decimal, .IntegerSize, .IonException, .IonReader, .IonCursor, .IonType, .SymbolTable, .SymbolToken, .SystemSymbols, .Timestamp, .UnknownSymbolException, java.io.IOException, java.math.BigDecimal, .BigInteger, java.util.ArrayDeque, .Date, .Iterator, .Queue

Provides a system-level view of an Ion stream. This differs from the application-level view in that system values (IVMs and symbol tables) are surfaced as if they were user values and symbols are not mapped, except for symbols that occur within the system symbol table. Because this is primarily intended to be used for debugging and is not exposed via public interfaces, it is not currently considered performance-critical, and no continuable equivalent is provided.

Field Summary

Modifier and TypeField and Description
private int
private final Queue<Integer>
private final IonReaderContinuableCore
private IonType
private IonType

Constructor Summary

AccessConstructor and Description
pack-priv
IonReaderNonContinuableSystem(IonReaderContinuableCore
the reader to wrap.
reader
)

Constructs a new non-continuable system-level reader over the given continuable reader.

Method Summary

Modifier and TypeMethod and Description
public <T> T
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 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 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 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 String[]
getTypeAnnotations()

Implements com.amazon.ion.IonReader.getTypeAnnotations.

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

public SymbolToken[]
getTypeAnnotationSymbols()

Implements com.amazon.ion.IonReader.getTypeAnnotationSymbols.

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

private boolean

Returns:

true if a value is ready to be presented to the user; otherwise, false.
handleIvm
()

Consumes an IVM that was encountered before the next value, presenting the IVM as a symbol value.

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 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.

private void
prepareScalar()

Prepares a scalar value to be parsed by ensuring it is present in the buffer.

public 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 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.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

pendingIvmSidback to summary
private int pendingIvmSid
pendingIvmSidsback to summary
private final Queue<Integer> pendingIvmSids
readerback to summary
private final IonReaderContinuableCore reader
typeback to summary
private IonType type
typeAfterIvmback to summary
private IonType typeAfterIvm

Constructor Detail

IonReaderNonContinuableSystemback to summary
pack-priv IonReaderNonContinuableSystem(IonReaderContinuableCore reader)

Constructs a new non-continuable system-level reader over the given continuable reader.

Parameters
reader:IonReaderContinuableCore

the reader to wrap.

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

An instance of T representing the facet of the subject, or null if the facet is not supported by the subject.

Annotations
@Override
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.

Annotations
@Override
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.

Annotations
@Override
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.

Annotations
@Override
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.

Annotations
@Override
closeback to summary
public void close() throws IOException

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.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
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.

Annotations
@Override
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.

Annotations
@Override
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.

Annotations
@Override
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.

Annotations
@Override
getDepthback to summary
public 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().

Annotations
@Override
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.

Annotations
@Override
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.

Annotations
@Override
getFieldNameSymbolback to summary
public 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.

Annotations
@Override
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.

Annotations
@Override
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.

Annotations
@Override
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.

Annotations
@Override
getTypeAnnotationsback to summary
public 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.

Annotations
@Override
getTypeAnnotationSymbolsback to summary
public 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.

Annotations
@Override
handleIvmback to summary
private boolean handleIvm()

Consumes an IVM that was encountered before the next value, presenting the IVM as a symbol value. If an IVM was emitted on the last invocation, restores the next value to be presented to the user.

Returns:boolean

true if a value is ready to be presented to the user; otherwise, false.

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()!

Annotations
@Override
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).

Annotations
@Override
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.

Annotations
@Override
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).

Annotations
@Override
iterateTypeAnnotationsback to summary
public 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.

Annotations
@Override
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).

Annotations
@Override
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.

Annotations
@Override
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.

Annotations
@Override
prepareScalarback to summary
private void prepareScalar()

Prepares a scalar value to be parsed by ensuring it is present in the buffer.

stepInback to summary
public 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.

Annotations
@Override
stepOutback to summary
public 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.

Annotations
@Override
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.

Annotations
@Override
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()

Annotations
@Override
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.

Annotations
@Override