if (dev == null) {
getError().getPrintWriter().println("No removable device found.");
return;
}
final RemovableDeviceAPI api = dev.getAPI(RemovableDeviceAPI.class);
try {
if (!api.canEject()) {
getError().getPrintWriter().format("No device found to %s.",
argLoad.isSet() ? "load" : "eject");
return;
}
if (argLoad.isSet()) {
api.load();
} else {
api.eject();
}
} catch (IOException ex) {
getError().getPrintWriter().format(fmt_failed, dev.getId(), ex.getLocalizedMessage());
exit(1);
}