in serialization/src/main/java/com/twitter/serial/stream/bytebuffer/ByteBufferSerializerInput.java [110:126]
public String readString() throws IOException {
final byte type = peekType();
if (type == SerializerDefs.TYPE_NULL) {
readNull();
return null;
}
if (type != SerializerDefs.TYPE_STRING_UTF8 && type != SerializerDefs.TYPE_STRING_ASCII) {
reportUnexpectedHeader(SerializerDefs.TYPE_STRING_UTF8, type);
}
final int length = readIntHeader(type);
if (length < 0) {
throw new SerializationException("String length is negative: " + length + ".");
} else if (length == 0) {
return "";
}
return type == SerializerDefs.TYPE_STRING_UTF8 ? decodeUtf8String(length) : decodeAsciiString(length);
}