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;
}
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);
}
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;
}
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);
}
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;
}
Aggregations