- if(VERIFY) verifyAccess();
- Pair<byte[],Integer> pair = toBytes();
- byte[] data = pair.first;
- int length = pair.second;
- FileIO fio = FileIO.get(bytes);
- int offset = fio.saveBytes(data, length, overwrite());
- setPosition(offset, length);
- }
-
- public int makeResident() {
+ if(VERIFY) {
+ try {
+ verifyAccess();
+ } catch (AcornAccessVerificationException e) {
+ throw new IOException("Exception occured during toFile for file " + fileName, e);
+ }
+ }
+ try {
+ Pair<byte[], Integer> pair = toBytes();
+ byte[] data = pair.first;
+ int length = pair.second;
+ FileIO fio = FileIO.get(bytes);
+ int offset = fio.saveBytes(data, length, overwrite());
+ setPosition(offset, length);
+ } catch (AcornAccessVerificationException | IllegalAcornStateException e) {
+ throw new IOException("Exception occured during toFile for file " + fileName, e);
+ }
+ }
+
+ public int makeResident() throws AcornAccessVerificationException, IllegalAcornStateException {