use of com.radixdlt.engine.parser.exceptions.SubstateDeserializationException in project radixdlt by radixdlt.
the class VirtualSubstateDeserialization method keyToSubstate.
public Particle keyToSubstate(byte typeByte, ByteBuffer buf) throws DeserializeException {
var deserializer = byteToDeserializer.get(typeByte);
if (deserializer == null) {
throw new DeserializeException("Unknown byte type: " + typeByte);
}
try {
var key = deserializer.keyDeserializer().deserialize(buf);
var rawSubstate = deserializer.virtualMapper().map(key);
if (buf.hasRemaining()) {
throw new TrailingBytesException("Buffer has " + buf.remaining() + " bytes remaining.");
}
return rawSubstate;
} catch (Exception e) {
throw new SubstateDeserializationException(deserializer.substateClass(), e);
}
}
use of com.radixdlt.engine.parser.exceptions.SubstateDeserializationException in project radixdlt by radixdlt.
the class SubstateDeserialization method deserialize.
public Particle deserialize(ByteBuffer buf) throws DeserializeException {
var typeByte = buf.get();
var deserializer = byteToDeserializer.get(typeByte);
if (deserializer == null) {
throw new DeserializeException("Unknown byte type: " + typeByte);
}
try {
return deserializer.deserializer().deserialize(buf);
} catch (Exception e) {
throw new SubstateDeserializationException(deserializer.substateClass(), e);
}
}
Aggregations