use of com.radixdlt.engine.parser.exceptions.REInstructionDataDeserializeException in project radixdlt by radixdlt.
the class REInstruction method readFrom.
public static REInstruction readFrom(REParser.ParserState parserState, ByteBuffer buf) throws DeserializeException, REInstructionDataDeserializeException {
var microOp = REMicroOp.fromByte(buf.get());
var savedLimit = buf.limit();
var pos = buf.position();
try {
// Set limit
buf = microOp.lengthType.setNextLimit(buf, microOp.minLength, microOp.maxLength);
var data = microOp.read(parserState, buf);
// Sanity check
if (buf.hasRemaining()) {
throw new IllegalStateException();
}
var length = buf.position() - pos;
buf.limit(savedLimit);
return new REInstruction(microOp, data, buf.array(), pos, length);
} catch (Exception e) {
throw new REInstructionDataDeserializeException(microOp, e);
}
}
Aggregations