in serialization/src/main/java/com/twitter/serial/stream/bytebuffer/ByteBufferSerializerInput.java [200:212]
private byte readHeader(byte expectedType) throws IOException {
try {
final byte header = mByteBuffer.get();
final byte actualType = ByteBufferSerializerDefs.getHeaderType(header);
if (actualType != expectedType) {
mByteBuffer.position(mByteBuffer.position() - 1);
return reportUnexpectedHeader(expectedType, actualType);
}
return ByteBufferSerializerDefs.getHeaderSubtype(header);
} catch (BufferUnderflowException ignore) {
throw new EOFException();
}
}