* @throws FileSystemException
*/
public void createImage() throws IOException, DriverException,
FileSystemException {
final FileDevice newFd = new FileDevice(destFile, "rw");
try {
newFd.setLength(getDeviceLength());
formatDevice(newFd);
final Device sysDev = getSystemDevice(newFd);
final BlockDeviceAPI sysDevApi = sysDev
.getAPI(BlockDeviceAPI.class);
copySystemFiles(sysDev);
sysDevApi.flush();
} catch (ApiNotFoundException ex) {
final IOException ioe = new IOException("BlockDeviceAPI not found on device");
ioe.initCause(ex);
throw ioe;
} finally {
newFd.close();
}
}