Search in sources :

Example 1 with IonTextUtils.printCodePointAsString

use of com.amazon.ion.util.IonTextUtils.printCodePointAsString in project ion-java by amzn.

the class IonReaderTextRawTokensX method read_hex_escape_sequence_value.

private final int read_hex_escape_sequence_value(int len) throws IOException {
    int hexchar = 0;
    while (len > 0) {
        len--;
        int c = read_char();
        if (c < 0) {
            unexpected_eof();
        }
        int d = IonTokenConstsX.hexDigitValue(c);
        if (d < 0)
            return -1;
        hexchar = (hexchar << 4) + d;
    }
    if (len > 0) {
        String message = "invalid hex digit [" + IonTextUtils.printCodePointAsString(hexchar) + "] in escape sequence";
        error(message);
    }
    return hexchar;
}
Also used : IonTextUtils.printCodePointAsString(com.amazon.ion.util.IonTextUtils.printCodePointAsString) SavePoint(com.amazon.ion.impl.UnifiedSavePointManagerX.SavePoint)

Example 2 with IonTextUtils.printCodePointAsString

use of com.amazon.ion.util.IonTextUtils.printCodePointAsString in project ion-java by amzn.

the class IonReaderTextRawTokensX method expected_but_found.

protected final void expected_but_found(String expected, int c) {
    String charStr = IonTextUtils.printCodePointAsString(c);
    String message = "Expected " + expected + " but found " + charStr + input_position();
    throw new IonReaderTextTokenException(message);
}
Also used : IonTextUtils.printCodePointAsString(com.amazon.ion.util.IonTextUtils.printCodePointAsString)

Example 3 with IonTextUtils.printCodePointAsString

use of com.amazon.ion.util.IonTextUtils.printCodePointAsString in project ion-java by amzn.

the class IonReaderTextRawTokensX method load_blob.

protected void load_blob(StringBuilder sb) throws IOException {
    int c;
    for (; ; ) {
        c = read_base64_byte();
        if (c == UnifiedInputStreamX.EOF) {
            break;
        }
        sb.append(c);
    }
    // did we hit EOF or the first '}' ?
    if (_stream.isEOF())
        unexpected_eof();
    c = read_char();
    if (c < 0) {
        unexpected_eof();
    }
    if (c != '}') {
        String message = "improperly closed BLOB, " + IonTextUtils.printCodePointAsString(c) + " encountered when '}' was expected";
        error(message);
    }
    return;
}
Also used : IonTextUtils.printCodePointAsString(com.amazon.ion.util.IonTextUtils.printCodePointAsString) SavePoint(com.amazon.ion.impl.UnifiedSavePointManagerX.SavePoint)

Example 4 with IonTextUtils.printCodePointAsString

use of com.amazon.ion.util.IonTextUtils.printCodePointAsString in project ion-java by amzn.

the class IonReaderTextRawTokensX method bad_token.

protected final void bad_token(int c) {
    String charStr = IonTextUtils.printCodePointAsString(c);
    String message = "a bad character " + charStr + " was encountered " + input_position();
    throw new IonReaderTextTokenException(message);
}
Also used : IonTextUtils.printCodePointAsString(com.amazon.ion.util.IonTextUtils.printCodePointAsString)

Example 5 with IonTextUtils.printCodePointAsString

use of com.amazon.ion.util.IonTextUtils.printCodePointAsString in project ion-java by amzn.

the class IonReaderTextRawTokensX method skip_over_blob.

private void skip_over_blob(SavePoint sp) throws IOException {
    int c = skip_over_blob_whitespace();
    for (; ; ) {
        if (c == UnifiedInputStreamX.EOF)
            break;
        if (c == '}')
            break;
        c = skip_over_blob_whitespace();
    }
    if (sp != null) {
        // we don't care about these last 2 closing curly braces
        // but we may have seen one of them already
        int offset = (c == '}') ? -1 : 0;
        sp.markEnd(offset);
    }
    // did we hit EOF or the first '}' ?
    if (c != '}')
        unexpected_eof();
    c = read_char();
    if (c < 0) {
        unexpected_eof();
    }
    if (c != '}') {
        String message = "improperly closed BLOB, " + IonTextUtils.printCodePointAsString(c) + " encountered when '}' was expected";
        error(message);
    }
    if (sp != null) {
        sp.markEnd();
    }
    return;
}
Also used : IonTextUtils.printCodePointAsString(com.amazon.ion.util.IonTextUtils.printCodePointAsString) SavePoint(com.amazon.ion.impl.UnifiedSavePointManagerX.SavePoint)

Aggregations

IonTextUtils.printCodePointAsString (com.amazon.ion.util.IonTextUtils.printCodePointAsString)5 SavePoint (com.amazon.ion.impl.UnifiedSavePointManagerX.SavePoint)3