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

pack-priv abstract Class IonReaderTextRawX

extends Object
implements IonTextReader
Class Inheritance
All Implemented Interfaces
com.amazon.ion.IonTextReader, com.amazon.ion.IonReader, com.amazon.ion.facet.Faceted, java.io.Closeable, java.lang.AutoCloseable
Known Direct Subclasses
com.amazon.ion.impl.IonReaderTextSystemX
Static Imports
com.amazon.ion.SymbolTable.UNKNOWN_SYMBOL_ID, com.amazon.ion.impl.IonTokenConstsX.TOKEN_CLOSE_BRACE, .IonTokenConstsX.TOKEN_CLOSE_PAREN, .IonTokenConstsX.TOKEN_CLOSE_SQUARE

References Deprecated

IonTextReader is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Reader implementation that reads the token stream and validates the Ion grammar. This does not care about system values. It does not materialize values or convert them. It does mark values in the UnifiedInputStream if they might be field names or annotations since it does populate these properties directly. Otherwise it accepts the TextRawToken's assessment of the type of the next token, which is based on as few characters as possible, typically 1 but generally less than 5. This is called by the IonReaderTextSystemX, which in turn is most often called by the IonReaderTextUserX. One of these two (system reader or user reader) should be invoked by the user for reading text Ion data. This class is not intended for general use. This reader scan skip values and in doing so it does not materialize the contents and it does not validate the contents. TODO amazon-ion/ion-java/issues/7 We may want to make validation on skip optional. This manages the value buffer (_v ValueVariant) and the lob content (_lob_*) which is cached in some cases. It's main job however is recognizing the correct order of the input tokens. This is done in parse_to_next_value (called by hasNext). The current state is represented by an int (whose value should be one of the values of the STATE_* constants). The legal transitions are stored in TransitionActions and TransitionActions2. The first (TransitionActions) is a two dimensional array whose dimensions are state and input token. The value stored is an int that represents the action to be taken (ACTION_*). The second copy of this data (TransitionActions2) is a one dimensional array built from the first and manually dereferenced in the parse_to_next_value method. This turns out to be a significant performance gain (). Logically these are the same.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
pack-priv static enum

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv SymbolToken[]
pack-priv boolean
pack-priv boolean
pack-priv IonType[]
pack-priv int
pack-priv StringBuilder
pack-priv boolean
pack-priv UnifiedSavePointManagerX.SavePoint
pack-priv boolean
pack-priv static final boolean
pack-priv boolean
pack-priv String
pack-priv int
pack-priv boolean
pack-priv int
pack-priv byte[]
pack-priv IonReaderTextRawX.LOB_STATE
pack-priv int
pack-priv long
pack-priv boolean
pack-priv IonType
pack-priv IonType
pack-priv IonReaderTextRawTokensX
pack-priv int
pack-priv _Private_ScalarConversions.ValueVariant
pack-priv int
pack-priv long
pack-priv long
pack-priv long
pack-priv IonType
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
private static final int
private static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int[][]
pack-priv static final int[]
protected static final int

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
private final void
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 abstract BigInteger
bigIntegerValue()

Redeclares com.amazon.ion.IonReader.bigIntegerValue.

Returns the current value as a BigInteger.

private final void
check_container_close(IonType container, int expectedToken, int actualToken)

private final void
protected final void
private final void
private final void
public void
close()

Implements java.io.Closeable.close.

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

private final void
current_value_is_bool(boolean value)

private final void
private final void
private final void
private final String
get_action_name(int action)

private final int
private final int
private final int
private final int
private int
private final int
private final int
private final String
get_state_name(int state)

private final String
public IonType
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).

pack-priv final String
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.

protected final boolean
public boolean

Returns:

true if more data remains, false on eof
hasNext
()

Implements com.amazon.ion.IonReader.hasNext.

this looks forward to see if there is an upcoming value if there is it returns true.

protected final void
protected final void
init(UnifiedInputStreamX iis, IonType parent, long start_line, long start_column)

protected final void
private boolean
public boolean
isInStruct()

Implements com.amazon.ion.IonReader.isInStruct.

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

public Iterator<String>
iterateTypeAnnotations()

Implements com.amazon.ion.IonReader.iterateTypeAnnotations.

Return the annotations on the curent value as an iterator.

pack-priv static int[]
pack-priv static final int[][]
public IonType

Returns:

type of the next value, or null if there is none.
next
()

Implements com.amazon.ion.IonReader.next.

returns the type of the next value in the stream.

protected final void
protected final void
protected final void
private final SymbolToken
private final void
private final void
protected final void
re_init(UnifiedInputStreamX iis, IonType parent, long start_line, long start_column)

private final void
private final void
private final void
set_state(int new_state)

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.

protected final StringBuilder
token_contents_load(int token_type)

protected void
tokenValueIsFinished()

called by super classes to tell us that the current token has been consumed.

private final IonType
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_annotation_countback to summary
pack-priv int _annotation_count
_annotationsback to summary
pack-priv SymbolToken[] _annotations
_container_is_structback to summary
pack-priv boolean _container_is_struct
_container_prohibits_commasback to summary
pack-priv boolean _container_prohibits_commas
_container_state_stackback to summary
pack-priv IonType[] _container_state_stack
_container_state_topback to summary
pack-priv int _container_state_top
_current_value_bufferback to summary
pack-priv StringBuilder _current_value_buffer
_current_value_buffer_loadedback to summary
pack-priv boolean _current_value_buffer_loaded
_current_value_save_pointback to summary
pack-priv UnifiedSavePointManagerX.SavePoint _current_value_save_point
_current_value_save_point_loadedback to summary
pack-priv boolean _current_value_save_point_loaded
_debugback to summary
pack-priv static final boolean _debug
_eofback to summary
pack-priv boolean _eof
_field_nameback to summary
pack-priv String _field_name
_field_name_sidback to summary
pack-priv int _field_name_sid
_has_next_calledback to summary
pack-priv boolean _has_next_called
_lob_actual_lenback to summary
pack-priv int _lob_actual_len
_lob_bytesback to summary
pack-priv byte[] _lob_bytes
_lob_loadedback to summary
pack-priv IonReaderTextRawX.LOB_STATE _lob_loaded
_lob_tokenback to summary
pack-priv int _lob_token
_lob_value_positionback to summary
pack-priv long _lob_value_position
_lob_value_setback to summary
pack-priv boolean _lob_value_set
_nesting_parentback to summary
pack-priv IonType _nesting_parent
_null_typeback to summary
pack-priv IonType _null_type
_scannerback to summary
pack-priv IonReaderTextRawTokensX _scanner
_stateback to summary
pack-priv int _state
_vback to summary
pack-priv _Private_ScalarConversions.ValueVariant _v
_value_keywordback to summary
pack-priv int _value_keyword
_value_start_columnback to summary
pack-priv long _value_start_column
_value_start_lineback to summary
pack-priv long _value_start_line
_value_start_offsetback to summary
pack-priv long _value_start_offset
_value_typeback to summary
pack-priv IonType _value_type
ACTION_countback to summary
pack-priv static final int ACTION_count
ACTION_EAT_COMMAback to summary
pack-priv static final int ACTION_EAT_COMMA
ACTION_EOFback to summary
pack-priv static final int ACTION_EOF
ACTION_FINISH_CONTAINERback to summary
pack-priv static final int ACTION_FINISH_CONTAINER
ACTION_FINISH_DATAGRAMback to summary
pack-priv static final int ACTION_FINISH_DATAGRAM
ACTION_FINISH_LOBback to summary
pack-priv static final int ACTION_FINISH_LOB
ACTION_LOAD_ANNOTATIONback to summary
pack-priv static final int ACTION_LOAD_ANNOTATION
ACTION_LOAD_FIELD_NAMEback to summary
pack-priv static final int ACTION_LOAD_FIELD_NAME
ACTION_LOAD_SCALARback to summary
pack-priv static final int ACTION_LOAD_SCALAR
ACTION_MINUS_INFback to summary
pack-priv static final int ACTION_MINUS_INF
ACTION_NOT_DEFINEDback to summary
pack-priv static final int ACTION_NOT_DEFINED
ACTION_PLUS_INFback to summary
pack-priv static final int ACTION_PLUS_INF
ACTION_START_LISTback to summary
pack-priv static final int ACTION_START_LIST
ACTION_START_LOBback to summary
pack-priv static final int ACTION_START_LOB
ACTION_START_SEXPback to summary
pack-priv static final int ACTION_START_SEXP
ACTION_START_STRUCTback to summary
pack-priv static final int ACTION_START_STRUCT
DEFAULT_ANNOTATION_COUNTback to summary
private static final int DEFAULT_ANNOTATION_COUNT
DEFAULT_STACK_DEPTHback to summary
private static final int DEFAULT_STACK_DEPTH
STATE_AFTER_VALUE_CONTENTSback to summary
pack-priv static final int STATE_AFTER_VALUE_CONTENTS
STATE_BEFORE_ANNOTATION_CONTAINEDback to summary
pack-priv static final int STATE_BEFORE_ANNOTATION_CONTAINED
STATE_BEFORE_ANNOTATION_DATAGRAMback to summary
pack-priv static final int STATE_BEFORE_ANNOTATION_DATAGRAM
STATE_BEFORE_ANNOTATION_SEXPback to summary
pack-priv static final int STATE_BEFORE_ANNOTATION_SEXP
STATE_BEFORE_FIELD_NAMEback to summary
pack-priv static final int STATE_BEFORE_FIELD_NAME
STATE_BEFORE_VALUE_CONTENTback to summary
pack-priv static final int STATE_BEFORE_VALUE_CONTENT
STATE_BEFORE_VALUE_CONTENT_SEXPback to summary
pack-priv static final int STATE_BEFORE_VALUE_CONTENT_SEXP
STATE_EOFback to summary
pack-priv static final int STATE_EOF
STATE_IN_BLOB_CONTENTback to summary
pack-priv static final int STATE_IN_BLOB_CONTENT
STATE_IN_CLOB_DOUBLE_QUOTED_CONTENTback to summary
pack-priv static final int STATE_IN_CLOB_DOUBLE_QUOTED_CONTENT
STATE_IN_CLOB_TRIPLE_QUOTED_CONTENTback to summary
pack-priv static final int STATE_IN_CLOB_TRIPLE_QUOTED_CONTENT
STATE_IN_LONG_STRINGback to summary
pack-priv static final int STATE_IN_LONG_STRING
STATE_MAXback to summary
pack-priv static final int STATE_MAX
TransitionActionsback to summary
pack-priv static final int[][] TransitionActions
TransitionActions2back to summary
pack-priv static final int[] TransitionActions2
UNKNOWN_SIZEback to summary
protected static final int UNKNOWN_SIZE

Constructor Detail

IonReaderTextRawXback to summary
protected IonReaderTextRawX()

Method Detail

append_annotationback to summary
private final void append_annotation(SymbolToken sym)
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.

bigIntegerValueback to summary
public abstract BigInteger bigIntegerValue()

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

check_container_closeback to summary
private final void check_container_close(IonType container, int expectedToken, int actualToken)
clear_annotation_listback to summary
private final void clear_annotation_list()
clear_current_value_bufferback to summary
protected final void clear_current_value_buffer()
clear_fieldnameback to summary
private final void clear_fieldname()
clear_valueback to summary
private final void clear_value()
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.

Exceptions
IOException:
if an I/O error occurs
current_value_is_boolback to summary
private final void current_value_is_bool(boolean value)
current_value_is_nullback to summary
private final void current_value_is_null(IonType null_type)
finish_and_save_valueback to summary
private final void finish_and_save_value() throws IOException
finish_valueback to summary
private final void finish_value(UnifiedSavePointManagerX.SavePoint sp) throws IOException
get_action_nameback to summary
private final String get_action_name(int action)
Annotations
@SuppressWarnings:unused
get_state_after_annotationback to summary
private final int get_state_after_annotation()
get_state_after_containerback to summary
private final int get_state_after_container()
get_state_after_containerback to summary
private final int get_state_after_container(int token)
get_state_after_containerback to summary
private final int get_state_after_container(IonType container)
get_state_after_valueback to summary
private int get_state_after_value()
get_state_at_container_startback to summary
private final int get_state_at_container_start(IonType container)
get_state_intback to summary
private final int get_state_int()
get_state_nameback to summary
private final String get_state_name(int state)
get_state_nameback to summary
private final String get_state_name()
getContainerTypeback to summary
public IonType getContainerType()
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().

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

getRawFieldNameback to summary
pack-priv final String getRawFieldName()
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.

has_next_raw_valueback to summary
protected final boolean has_next_raw_value()
hasNextback to summary
public boolean hasNext()

Implements com.amazon.ion.IonReader.hasNext.

this looks forward to see if there is an upcoming value if there is it returns true. It may have to clean up any value that's partially complete (for example a collection whose annotation has been read and loaded but the user has chosen not to step into the collection).

Returns:boolean

true if more data remains, false on eof

initback to summary
protected final void init(UnifiedInputStreamX iis, IonType parent)
initback to summary
protected final void init(UnifiedInputStreamX iis, IonType parent, long start_line, long start_column)
init_onceback to summary
protected final void init_once()
is_in_struct_internalback to summary
private boolean is_in_struct_internal()
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.

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.

makeTransition2ActionArrayback to summary
pack-priv static int[] makeTransition2ActionArray()
makeTransitionActionArrayback to summary
pack-priv static final int[][] makeTransitionActionArray()
nextback to summary
public IonType next()

Implements com.amazon.ion.IonReader.next.

returns the type of the next value in the stream. it calls hasNext to assure that the value has been properly started, since hasNext prepares a value as a side effect of determining whether or not a value is pending. A NoSuchElementException is thrown if there are not values remaining. Once called if there is a value available it's contents can be accessed through the other public API's (such as getLong()).

Returns:IonType

type of the next value, or null if there is none.

parse_errorback to summary
protected final void parse_error(String reason)
parse_errorback to summary
protected final void parse_error(Exception e)
parse_to_next_valueback to summary
protected final void parse_to_next_value() throws IOException
parseSymbolTokenback to summary
private final SymbolToken parseSymbolToken(String context, StringBuilder sb, int t) throws IOException
pop_container_stateback to summary
private final void pop_container_state()
push_container_stateback to summary
private final void push_container_state(IonType newContainer)
re_initback to summary
protected final void re_init(UnifiedInputStreamX iis, IonType parent, long start_line, long start_column)
set_container_flagsback to summary
private final void set_container_flags(IonType t)
set_fieldnameback to summary
private final void set_fieldname(SymbolToken sym)
set_stateback to summary
private final void set_state(int new_state)
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.

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.

token_contents_loadback to summary
protected final StringBuilder token_contents_load(int token_type) throws IOException
tokenValueIsFinishedback to summary
protected void tokenValueIsFinished()

called by super classes to tell us that the current token has been consumed.

top_stateback to summary
private final IonType top_state()
com.amazon.ion.impl back to summary

public Class IonReaderTextRawX.IonReaderTextParsingException

extends IonException
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
pack-priv

Method Summary

Inherited from com.amazon.ion.IonException:
causeOfType

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.amazon.ion.IonException.serialVersionUID.

Constructor Detail

IonReaderTextParsingExceptionback to summary
pack-priv IonReaderTextParsingException(String msg)
IonReaderTextParsingExceptionback to summary
pack-priv IonReaderTextParsingException(Exception e)
IonReaderTextParsingExceptionback to summary
pack-priv IonReaderTextParsingException(String msg, Exception e)
com.amazon.ion.impl back to summary

pack-priv final Enum IonReaderTextRawX.LOB_STATE

extends Enum<IonReaderTextRawX.LOB_STATE>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final IonReaderTextRawX.LOB_STATE
public static final IonReaderTextRawX.LOB_STATE
public static final IonReaderTextRawX.LOB_STATE

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static IonReaderTextRawX.LOB_STATE
public static IonReaderTextRawX.LOB_STATE[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

EMPTYback to summary
public static final IonReaderTextRawX.LOB_STATE EMPTY
FINISHEDback to summary
public static final IonReaderTextRawX.LOB_STATE FINISHED
READback to summary
public static final IonReaderTextRawX.LOB_STATE READ

Constructor Detail

LOB_STATEback to summary
private LOB_STATE()

Method Detail

valueOfback to summary
public static IonReaderTextRawX.LOB_STATE valueOf(String name)
valuesback to summary
public static IonReaderTextRawX.LOB_STATE[] values()