in aws-android-sdk-appsync-runtime/src/main/java/com/apollographql/apollo/internal/json/BufferedSourceJsonReader.java [390:431]
private int peekKeyword() throws IOException {
// Figure out which keyword we're matching against by its first character.
byte c = buffer.getByte(0);
String keyword;
String keywordUpper;
int peeking;
if (c == 't' || c == 'T') {
keyword = "true";
keywordUpper = "TRUE";
peeking = PEEKED_TRUE;
} else if (c == 'f' || c == 'F') {
keyword = "false";
keywordUpper = "FALSE";
peeking = PEEKED_FALSE;
} else if (c == 'n' || c == 'N') {
keyword = "null";
keywordUpper = "NULL";
peeking = PEEKED_NULL;
} else {
return PEEKED_NONE;
}
// Confirm that chars [1..length) match the keyword.
int length = keyword.length();
for (int i = 1; i < length; i++) {
if (!source.request(i + 1)) {
return PEEKED_NONE;
}
c = buffer.getByte(i);
if (c != keyword.charAt(i) && c != keywordUpper.charAt(i)) {
return PEEKED_NONE;
}
}
if (source.request(length + 1) && isLiteral(buffer.getByte(length))) {
return PEEKED_NONE; // Don't match trues, falsey or nullsoft!
}
// We've found the keyword followed either by EOF or by a non-literal character.
buffer.skip(length);
return peeked = peeking;
}