in tablestore/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferCodedInputStream.java [117:164]
public PlainBufferCell readCell(boolean isPK) throws IOException {
if (!checkLastTagWas(TAG_CELL)) {
throw new IOException("Expect TAG_CELL but it was " + PlainBufferConsts.printTag(getLastTag()));
}
PlainBufferCell cell = new PlainBufferCell();
readTag();
if (getLastTag() == TAG_CELL_NAME) {
cell.setCellName(input.readUTFString(input.readRawLittleEndian32()));
readTag();
}
if (getLastTag() == TAG_CELL_VALUE) {
if (isPK) {
cell.setPkCellValue(readCellPrimaryKeyValue());
} else {
cell.setCellValue(readCellValue());
}
}
if (getLastTag() == TAG_CELL_TYPE) {
cell.setCellType(input.readRawByte());
readTag();
}
if (getLastTag() == TAG_CELL_TIMESTAMP) {
long timestamp = input.readInt64();
if (timestamp < 0) {
throw new IOException("The timestamp is negative.");
}
cell.setCellTimestamp(timestamp);
readTag(); // consume next tag as all read function should consume next tag
}
if (getLastTag() == TAG_CELL_CHECKSUM) {
byte checksum = input.readRawByte();
readTag();
if (cell.getChecksum() != checksum) {
logger.error("Checksum mismatch. Cell: " + cell.toString() + ". Checksum: " + checksum + ". PlainBuffer: " + input.toString());
throw new IOException("Checksum is mismatch.");
}
} else {
throw new IOException("Expect TAG_CELL_CHECKSUM but it was " + PlainBufferConsts.printTag(getLastTag()));
}
return cell;
}