Added getSuggestedFilename and a null createFile (to get rid of

error messages; will be implemented later).
This commit is contained in:
Robert Greene 2003-01-26 02:39:39 +00:00
parent 0ce42f9f7e
commit d6867f61db
1 changed files with 29 additions and 0 deletions

View File

@ -131,6 +131,14 @@ public class PascalFormatDisk extends FormattedDisk {
}
return list;
}
/**
* Create a new FileEntry.
*/
public FileEntry createFile() throws DiskFullException {
// FIXME: Need to implement!
return null;
}
/**
* Read directory blocks. These are always in blocks 2 - 5 and
@ -426,4 +434,25 @@ public class PascalFormatDisk extends FormattedDisk {
public int getLogicalDiskNumber() {
return 0;
}
/**
* Returns a valid filename for the given filename. This is somewhat
* of a guess, but the Pascal filenames appear to have similar
* restrictions as ProDOS.
*/
public String getSuggestedFilename(String filename) {
StringBuffer newName = new StringBuffer();
if (!Character.isLetter(filename.charAt(0))) {
newName.append('A');
}
int i=0;
while (newName.length() < 15 && i<filename.length()) {
char ch = filename.charAt(i);
if (Character.isLetterOrDigit(ch) || ch == '.') {
newName.append(ch);
}
i++;
}
return newName.toString().toUpperCase().trim();
}
}