public void setBytes(int memoryOffset, byte[] buffer, int bufferOffset, int length) { if (length == 0) { return; } if ((memoryOffset & 1) == 1) { throw new IndexOutOfBoundsException("offset must be even"); } if ((length & 1) == 1) { throw new IndexOutOfBoundsException("length must be even"); } ensureInBounds(memoryOffset, buffer, bufferOffset, length); System.arraycopy(buffer, bufferOffset, bytes, memoryOffset, length); if (fileName == null) { return; } try { DataOutputStream output = Connector.openDataOutputStream("file://" + fileName); output.writeInt(startAddress.toUWord().toInt()); output.writeInt(size); output.writeShort(purpose); output.write(bytes); output.close(); } catch (IOException e) { throw new RuntimeException(e.getMessage()); } }