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

pack-priv final Class IonReaderTextRawTokensX

extends Object
Class Inheritance
Static Imports
com.amazon.ion.impl.IonTokenConstsX.CharacterSequence.CHAR_SEQ_ESCAPED_NEWLINE_SEQUENCE_1, .IonTokenConstsX.CharacterSequence.CHAR_SEQ_ESCAPED_NEWLINE_SEQUENCE_2, .IonTokenConstsX.CharacterSequence.CHAR_SEQ_ESCAPED_NEWLINE_SEQUENCE_3, .IonTokenConstsX.CharacterSequence.CHAR_SEQ_NEWLINE_SEQUENCE_1, .IonTokenConstsX.CharacterSequence.CHAR_SEQ_NEWLINE_SEQUENCE_2, .IonTokenConstsX.CharacterSequence.CHAR_SEQ_NEWLINE_SEQUENCE_3, com.amazon.ion.util.IonTextUtils.printCodePointAsString

Tokenizer for the Ion text parser in IonTextIterator. This reads bytes and returns the interesting tokens it recognizes or an error. While, currently, this does UTF-8 decoding as it goes that is unnecessary. The main entry point is lookahead(n) which gets the token type n tokens ahead (0 is the next token). The tokens type, its starting offset in the input stream and its ending offset in the input stream are cached, so lookahead() can be called repeatedly with little overhead. This supports a 7 token lookahead and requires a "recompile" to change this limit. (this could be "fixed" but seems unnecessary at this time - the limit is in IonTextTokenizer._token_lookahead_size which is 1 larger than the size of the lookahead allowed) Tokens are consumed by a call to consumeToken, or the helper consumeTokenAsString. The informational interfaces - getValueStart(), getValueEnd() getValueAsString() can be used to get the contents of the value once the caller has decided how to use it. This is a copy and paste from IonTextTokenize on the introduction of the new input abstraction IonInputStream as the source of characters and bytes for the reader. This variation does NOT make local copies of the tokens. It does start "marking" at the beginning of the token and the end. The stream will buffer the input until the mark is released. The result is that only the most recent token is available to the calling reader.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum
IonReaderTextRawTokensX.CommentStrategy

Defines strategies to apply when comments are encountered.

public static class
private static enum
private static enum
private static enum

Field Summary

Modifier and TypeField and Description
private int
_base64_prefetch_count

number of base64 decoded bytes in the stack, used to decode base64

private int
_base64_prefetch_stack

since this "stack" will only 0-2 bytes deep, we'll just shift them into an int

pack-priv static final boolean
private long
private long
private boolean
private long
private long
private UnifiedInputStreamX
private int
private boolean
_unfinished_token

are we at the beginning of this token (false == done with it)

pack-priv static final int[]
pack-priv static final int
pack-priv static final int
private static final int
private final ArrayList<Integer>
private static final Appendable

Constructor Summary

AccessConstructor and Description
public
IonReaderTextRawTokensX(UnifiedInputStreamX
wrapped input stream
iis
)

IonTokenReader constructor requires a UnifiedInputStream as the source of bytes/chars that serve as the basic input

public
IonReaderTextRawTokensX(UnifiedInputStreamX iis, long starting_line, long starting_column)

Method Summary

Modifier and TypeMethod and Description
protected final void
protected final void
protected final void
bad_token(int c)

protected final void
private boolean
check_for_low_surrogate(int c, boolean expectLowSurrogate)

public void
private static final int
decode_base64_byte1(int c1, int c2, int c3, int c4)

private static final int
decode_base64_byte2(int c1, int c2, int c3, int c4)

private static final int
decode_base64_byte3(int c1, int c2, int c3, int c4)

private static final int
decode_base64_length(int c1, int c2, int c3, int c4)

protected final void
error(String message)

protected final void
expected_but_found(String expected, int c)

protected final void
public long
public long
pack-priv UnifiedInputStreamX
public final long
public int
protected String
private final boolean

Returns:

true if the next two characters are single quotes
is_2_single_quotes_helper
()

this peeks ahead to see if the next two characters are single quotes.

private final boolean
public final boolean
public final boolean
private final int
line_count(int c)

private final int
protected void
protected void
load_clob(int lobToken, StringBuilder sb)

private final int

Returns:

the first non-digit character on the input. Could be the given character if its not a digit.
load_digits
(StringBuilder sb, int c)

Accumulates digits into the buffer, starting with the given character.

protected int
private final int
private final IonType
load_finish_number(CharSequence numericText, int c, int token)

private final void
protected IonType
protected void
load_raw_characters(StringBuilder sb)

this is used to load a previously marked set of bytes into the StringBuilder without escaping.

protected int
protected void
protected void
private final IonType
protected int
private final int
private final int
next_token_finish(int token, boolean content_is_waiting)

public final int
private final boolean
public final int

Returns:

true if the next token is a double or triple quote, false otherwise
peekLobStartPunctuation
()

peeks into the input stream to see what non-whitespace character is coming up.

public final int
peekNullTypeSymbol()

peeks into the input stream to see if we have an unquoted symbol that resolves to one of the ion types.

private final int
peekNullTypeSymbolUndo(int[] read_ahead, int read_count)

public final int
private final int
private final int
private final int
private final int
protected final int
private final int
read_char_escaped(int c, boolean is_clob)

protected int
read_double_quoted_char(boolean is_clob)

private final int
read_escaped_char_content_helper(int c1, boolean is_clob)

private final int
private final int
protected final int
read_string_char(IonReaderTextRawTokensX.ProhibitedCharacters prohibitedCharacters)

NOT for use outside of string/symbol/clob!

protected int
read_triple_quoted_char(boolean is_clob)

private final int
private int
private int
protected void
protected void
protected void
private final int

Returns:

numeric token type
scan_for_numeric_type
(int
first char of number read by caller
c1
)

we encountered a character that starts a number, a digit or a dash (minus).

private final int

Returns:

numeric token type
scan_negative_for_numeric_type
(int
first char of number read by caller
c
)

variant of scan_numeric_type where the passed in start character was preceded by a minus sign.

private final void
protected final void
skip_clob_close_punctuation()

Expects optional whitespace then }}

private void
private final void
private int
private void
private final int

Returns:

the next character in the stream
skip_over_blob_whitespace
()

Skip over whitespace, but not the / character, as it's a valid Base64 character.

private final int

Returns:

the next character in the stream
skip_over_clob_whitespace
()

Skip over the whitespace after the clob string and before the closing braces.

private void
skip_over_container(int terminator)

private int
private int
private int
private int
protected void
protected void
skip_over_lob(int lobToken, UnifiedSavePointManagerX.SavePoint sp)

Skips over the closing }} too.

private final int

Returns:

the next character in the stream
skip_over_lob_whitespace
()

The type of lob is not yet known.

private int
protected void
protected void
private final int
private int
private int
private final int

Returns:

the next character in the stream
skip_over_whitespace
()

Skip over any whitespace, ignoring any comments.

private final int

Returns:

the next character in the stream
skip_over_whitespace
(IonReaderTextRawTokensX.CommentStrategy
the strategy to use upon encountering comments.
commentStrategy
)

Skip over any whitespace, applying the given CommentStrategy to any comments found.

private final void
private final int
private int
private int
private final int
skip_timestamp_past_digits(int len)

Helper method for skipping embedded digits inside a timestamp value.

private final int
skip_timestamp_past_digits(int min, int max)

Helper method for skipping embedded digits inside a timestamp value This overload skips at least min and at most max digits, and errors if a non-digit is encountered in the first min characters read

private final void
skip_timestamp_validate(int c, int expected)

private final int
private void
skip_triple_quoted_clob_string(UnifiedSavePointManagerX.SavePoint sp)

Skip to the end of a triple quoted string sequence within a clob, erroring on any comments encountered between triple quoted string elements.

private void
skip_triple_quoted_string(UnifiedSavePointManagerX.SavePoint sp)

Skip to the end of a triple quoted string sequence, ignoring any comments encountered between triple quoted string elements.

private void
protected final boolean

Returns:

true if whitespace or comments were encountered
skip_whitespace
()

Skips whitespace and comments and finishes at the starting position of the next token.

private final boolean

Returns:

true if whitespace was skipped and/or comments ignored
skip_whitespace
(IonReaderTextRawTokensX.CommentStrategy commentStrategy)

Skips whitespace and applies the given CommentStrategy to any comments found.

public final boolean

Returns:

true if the next token is a double colon, false otherwise
skipDoubleColon
()

peeks into the input stream to see if the next token would be a double colon.

private int
public final void
protected final void
private final void
unread_char(int c)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait