Added the new image flag and SaveAs method (essentially a rename).

This commit is contained in:
Robert Greene 2003-12-08 00:50:06 +00:00
parent 4c10059f75
commit 00cb73dea2
1 changed files with 19 additions and 0 deletions

View File

@ -71,6 +71,7 @@ public class Disk {
private byte[] diskImage;
private String filename;
private boolean changed = false;
private boolean newImage = false;
/**
* Get the supported file filters supported by the Disk interface.
@ -112,6 +113,7 @@ public class Disk {
protected Disk(String filename, byte[] diskImage) {
this.diskImage = diskImage;
this.filename = filename;
this.newImage = true;
}
/**
@ -152,6 +154,15 @@ public class Disk {
output.write(getDiskImage());
output.close();
changed = false;
newImage = false;
}
/**
* Save a Disk image as a new/different file.
*/
public void saveAs(String filename) throws IOException {
this.filename = filename;
save();
}
/**
@ -533,4 +544,12 @@ public class Disk {
public boolean hasChanged() {
return changed;
}
/**
* Indicates if the disk image is new. This can be used
* for Save As processing.
*/
public boolean isNewImage() {
return newImage;
}
}