Within transactions writes to persistent memory such as EEPROM or flash are handled atomically. That is: as if all the writes to persistent memory are part of one big action.
To create an atomic copy you need to use Util.arrayCopy()
instead of Util.arrayCopyNonAtomic()
. There may also be other actions that can take part of atomicity. If actions that change persistent memory do not take part in an atomic transaction then the Java Card API will explicitly document those actions.
As indicated before, there is no method to reset a Java Card. Instead you can use JCSystem.abortTransaction()
.