Added generic ability the write boot code to track 0, sector 0.

This commit is contained in:
Robert Greene 2002-12-09 05:45:22 +00:00
parent 010ee8e488
commit e10e00eb41

View File

@ -19,6 +19,8 @@
*/
package com.webcodepro.applecommander.storage;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
@ -296,4 +298,28 @@ public abstract class FormattedDisk extends Disk {
}
return theFileEntry;
}
/**
* Format the disk. Make sure that this is what is intended -
* there is no backing out!
*/
public abstract void format();
/**
* Write the AppleCommander boot code to track 0 sector 0 of
* the disk. This will work for a floppy, but may cause problems
* for other devices.
*/
protected void writeBootCode() {
InputStream inputStream = getClass().
getResourceAsStream("AppleCommander-boot.dump");
if (inputStream != null) {
byte[] bootCode = new byte[SECTOR_SIZE];
try {
inputStream.read(bootCode, 0, bootCode.length);
writeSector(0, 0, bootCode);
} catch (IOException ignored) {
}
}
}
}