Class PascalFormatDisk
- java.lang.Object
-
- com.webcodepro.applecommander.storage.Disk
-
- com.webcodepro.applecommander.storage.FormattedDisk
-
- com.webcodepro.applecommander.storage.os.pascal.PascalFormatDisk
-
- All Implemented Interfaces:
DirectoryEntry
public class PascalFormatDisk extends FormattedDisk
Manages a disk that is in the Pascal format.Date created: Oct 4, 2002 11:56:50 PM
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.webcodepro.applecommander.storage.FormattedDisk
FormattedDisk.DiskInformation, FormattedDisk.DiskUsage, FormattedDisk.FileColumnHeader
-
Nested classes/interfaces inherited from class com.webcodepro.applecommander.storage.Disk
Disk.FilenameFilter
-
-
Field Summary
Fields Modifier and Type Field Description static int
ENTRY_SIZE
The size of the Pascal file entry.-
Fields inherited from class com.webcodepro.applecommander.storage.FormattedDisk
FILE_DISPLAY_DETAIL, FILE_DISPLAY_NATIVE, FILE_DISPLAY_STANDARD
-
Fields inherited from class com.webcodepro.applecommander.storage.Disk
APPLE_10MB_HARDDISK, APPLE_140KB_DISK, APPLE_140KB_NIBBLE_DISK, APPLE_20MB_HARDDISK, APPLE_32MB_HARDDISK, APPLE_5MB_HARDDISK, APPLE_800KB_2IMG_DISK, APPLE_800KB_DISK, BLOCK_SIZE, DOS33_SECTORS_ON_140KB_DISK, PRODOS_BLOCKS_ON_140KB_DISK, SECTOR_SIZE
-
-
Constructor Summary
Constructors Constructor Description PascalFormatDisk(java.lang.String filename, ImageOrder imageOrder)
Constructor for PascalFormatDisk.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canCreateDirectories()
Identify if additional directories can be created.boolean
canCreateFile()
Indicates if this disk image can create a file.boolean
canDeleteFile()
Indicates if this disk image can delete a file.boolean
canHaveDirectories()
Identify if this disk format is capable of having directories.boolean
canReadFileData()
Indicates if this disk image can read data from a file.boolean
canWriteFileData()
Indicates if this disk image can write data to a file.void
changeImageOrder(ImageOrder imageOrder)
Change to a different ImageOrder.static PascalFormatDisk[]
create(java.lang.String filename, java.lang.String volumeName, ImageOrder imageOrder)
Create a PascalFormatDisk.DirectoryEntry
createDirectory(java.lang.String name)
Create a new DirectoryEntry.PascalFileEntry
createFile()
Create a new FileEntry.void
format()
Format the disk as an Apple Pascal disk.java.lang.String
fromProdosFiletype(java.lang.String prodosFiletype)
Provides conversation from a given ProDOS file type since as it is common across many archiving tools.int[]
getBitmapDimensions()
Get suggested dimensions for display of bitmap.java.lang.String[]
getBitmapLabels()
Get the labels to use in the bitmap.int
getBitmapLength()
Get the length of the bitmap.int
getBlocksOnDisk()
Return the number of blocks on disk.java.util.List<PascalFileEntry>
getDirectory()
Retrieve the entire directory.DiskGeometry
getDiskGeometry()
Gives an indication on how this disk's geometry should be handled.java.util.List<FormattedDisk.DiskInformation>
getDiskInformation()
Get Pascal-specific disk information.java.lang.String
getDiskName()
Return the name of the disk.FormattedDisk.DiskUsage
getDiskUsage()
Get the disk usage iterator.java.util.List<FormattedDisk.FileColumnHeader>
getFileColumnHeaders(int displayMode)
Get the standard file column header information.byte[]
getFileData(FileEntry fileEntry)
Get the data associated with the specified FileEntry.java.util.List<FileEntry>
getFiles()
Retrieve a list of files.int
getFilesOnDisk()
Return the number of files on disk.java.lang.String[]
getFiletypes()
Returns a list of possible file types.int
getFirstBlock()
Return the first block.java.lang.String
getFormat()
Identify the operating system format of this disk.int
getFreeBlocks()
Return the number of free blocks.int
getFreeSpace()
Return the amount of free space in bytes.java.util.Date
getLastAccessDate()
Return the last access date.int
getLogicalDiskNumber()
Returns the logical disk number.java.util.Date
getMostRecentDateSetting()
Return the most recent date setting.java.lang.String
getSuggestedFilename(java.lang.String filename)
Returns a valid filename for the given filename.java.lang.String
getSuggestedFiletype(java.lang.String filename)
Returns a valid filetype for the given filename.int
getUsedBlocks()
Return the number of used blocks.int
getUsedSpace()
Return the amount of used space in bytes.protected byte[]
getVolumeEntry()
Return the volume entry.boolean
needsAddress(java.lang.String filetype)
Indicates if this filetype requires an address component.void
putDirectory(java.util.List<PascalFileEntry> files)
Write the revised directory.byte[]
readDirectory()
Read directory blocks.void
setDiskName(java.lang.String volumeName)
Set the name of the disk.void
setFileData(FileEntry fileEntry, byte[] fileData)
Writes the raw bytes into the file.boolean
supportsDeletedFiles()
Indicates if this disk format supports "deleted" files.boolean
supportsDiskMap()
Indicates if this FormattedDisk supports a disk map.java.lang.String
toProdosFiletype(java.lang.String nativeFiletype)
Provides conversation to a given ProDOS file type since as it is common across many archiving tools.void
writeDirectory(byte[] directory)
Write directory blocks.-
Methods inherited from class com.webcodepro.applecommander.storage.FormattedDisk
getDirname, getFile, getFile, getFormattedDisk, resizeDiskImage, writeBootCode
-
Methods inherited from class com.webcodepro.applecommander.storage.Disk
getAllExtensions, getDiskImageManager, getFilename, getFilenameFilters, getFormattedDisks, getImageOrder, getOrderName, getPhysicalSize, hasChanged, is140KbDisk, is2ImgOrder, is800KbDisk, isBXY, isCompressed, isCpmFormat, isDC42, isDosFormat, isDosOrder, isNakedosFormat, isNewImage, isNibbleOrder, isOzDosFormat, isPascalFormat, isProdosFormat, isProdosOrder, isRdos33Format, isRdosFormat, isSDK, isSHK, isUniDosFormat, isWPFormat, makeDosOrder, makeProdosOrder, readBlock, readSector, resizeDiskImage, save, saveAs, setFilename, setImageOrder, sizeToFit, testImageOrder, writeBlock, writeSector
-
-
-
-
Field Detail
-
ENTRY_SIZE
public static final int ENTRY_SIZE
The size of the Pascal file entry.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PascalFormatDisk
public PascalFormatDisk(java.lang.String filename, ImageOrder imageOrder)
Constructor for PascalFormatDisk.
-
-
Method Detail
-
create
public static PascalFormatDisk[] create(java.lang.String filename, java.lang.String volumeName, ImageOrder imageOrder)
Create a PascalFormatDisk.
-
getFormat
public java.lang.String getFormat()
Identify the operating system format of this disk.- Specified by:
getFormat
in classFormattedDisk
- See Also:
FormattedDisk.getFormat()
-
getFiles
public java.util.List<FileEntry> getFiles()
Retrieve a list of files.- See Also:
DirectoryEntry.getFiles()
-
getDirectory
public java.util.List<PascalFileEntry> getDirectory()
Retrieve the entire directory.
-
putDirectory
public void putDirectory(java.util.List<PascalFileEntry> files)
Write the revised directory.
-
createFile
public PascalFileEntry createFile() throws DiskFullException
Create a new FileEntry.- Throws:
DiskFullException
-
canCreateDirectories
public boolean canCreateDirectories()
Identify if additional directories can be created. This may indicate that directories are not available to this operating system or simply that the disk image is "locked" to writing.
-
canCreateFile
public boolean canCreateFile()
Indicates if this disk image can create a file. If not, the reason may be as simple as it has not beem implemented to something specific about the disk.
-
readDirectory
public byte[] readDirectory()
Read directory blocks. These are always in blocks 2 - 5 and are treated as a 2048 byte array.
-
writeDirectory
public void writeDirectory(byte[] directory)
Write directory blocks.
-
canHaveDirectories
public boolean canHaveDirectories()
Identify if this disk format is capable of having directories.- Specified by:
canHaveDirectories
in classFormattedDisk
- See Also:
FormattedDisk.canHaveDirectories()
-
getFreeSpace
public int getFreeSpace()
Return the amount of free space in bytes.- Specified by:
getFreeSpace
in classFormattedDisk
- See Also:
FormattedDisk.getFreeSpace()
-
getFreeBlocks
public int getFreeBlocks()
Return the number of free blocks.
-
getVolumeEntry
protected byte[] getVolumeEntry()
Return the volume entry.
-
getBlocksOnDisk
public int getBlocksOnDisk()
Return the number of blocks on disk.
-
getFilesOnDisk
public int getFilesOnDisk()
Return the number of files on disk.
-
getFirstBlock
public int getFirstBlock()
Return the first block.
-
getLastAccessDate
public java.util.Date getLastAccessDate()
Return the last access date.
-
getMostRecentDateSetting
public java.util.Date getMostRecentDateSetting()
Return the most recent date setting. Huh?
-
getUsedSpace
public int getUsedSpace()
Return the amount of used space in bytes.- Specified by:
getUsedSpace
in classFormattedDisk
- See Also:
FormattedDisk.getUsedSpace()
-
getUsedBlocks
public int getUsedBlocks()
Return the number of used blocks.
-
getDiskName
public java.lang.String getDiskName()
Return the name of the disk. This is stored on block #2 offset +6 (string[7]).- Specified by:
getDiskName
in classFormattedDisk
- See Also:
FormattedDisk.getDiskName()
-
setDiskName
public void setDiskName(java.lang.String volumeName)
Set the name of the disk. The Pascal parlance is "volume name" whereas AppleCommander uses disk name. Max length is 7.- Overrides:
setDiskName
in classFormattedDisk
-
getBitmapDimensions
public int[] getBitmapDimensions()
Get suggested dimensions for display of bitmap. Since Pascal disks are a block device, no suggestion is given.- Specified by:
getBitmapDimensions
in classFormattedDisk
-
getBitmapLength
public int getBitmapLength()
Get the length of the bitmap.- Specified by:
getBitmapLength
in classFormattedDisk
-
getDiskUsage
public FormattedDisk.DiskUsage getDiskUsage()
Get the disk usage iterator.- Specified by:
getDiskUsage
in classFormattedDisk
-
getBitmapLabels
public java.lang.String[] getBitmapLabels()
Get the labels to use in the bitmap.- Specified by:
getBitmapLabels
in classFormattedDisk
-
getDiskInformation
public java.util.List<FormattedDisk.DiskInformation> getDiskInformation()
Get Pascal-specific disk information.- Overrides:
getDiskInformation
in classFormattedDisk
-
getFileColumnHeaders
public java.util.List<FormattedDisk.FileColumnHeader> getFileColumnHeaders(int displayMode)
Get the standard file column header information. This default implementation is intended only for standard mode.- Overrides:
getFileColumnHeaders
in classFormattedDisk
-
supportsDeletedFiles
public boolean supportsDeletedFiles()
Indicates if this disk format supports "deleted" files.- Specified by:
supportsDeletedFiles
in classFormattedDisk
-
canReadFileData
public boolean canReadFileData()
Indicates if this disk image can read data from a file.- Specified by:
canReadFileData
in classFormattedDisk
-
canWriteFileData
public boolean canWriteFileData()
Indicates if this disk image can write data to a file.- Specified by:
canWriteFileData
in classFormattedDisk
-
canDeleteFile
public boolean canDeleteFile()
Indicates if this disk image can delete a file.- Specified by:
canDeleteFile
in classFormattedDisk
-
getFileData
public byte[] getFileData(FileEntry fileEntry)
Get the data associated with the specified FileEntry.- Specified by:
getFileData
in classFormattedDisk
- See Also:
FileEntry.getFileData()
-
format
public void format()
Format the disk as an Apple Pascal disk.- Specified by:
format
in classFormattedDisk
- See Also:
FormattedDisk.format()
-
getLogicalDiskNumber
public int getLogicalDiskNumber()
Returns the logical disk number. Returns a 0 to indicate no numbering.- Specified by:
getLogicalDiskNumber
in classFormattedDisk
-
getSuggestedFilename
public java.lang.String getSuggestedFilename(java.lang.String filename)
Returns a valid filename for the given filename. Summary taken from the filename description in "Apple Pascal: Operating System Reference Manual." A legal diskette filename can consist of up to 15 characters. Lower- case letters typed into a filename are translated to upper-case, and spaces and non-printing characters are removed from the filename. All characters are legal in filenames. However, from the keyboard you should not type filenames that include the following characters: dollar sign ($), left square bracket ([), equals sign (=) question mark, (?), RETURN, and the CTRL characters C, F, M, S, U, and @. WARNING: The Filer will not be able to access filenames containing the characters dollar sign ($), equals sign (=), question mark (?), or comma (,)- Specified by:
getSuggestedFilename
in classFormattedDisk
-
getSuggestedFiletype
public java.lang.String getSuggestedFiletype(java.lang.String filename)
Returns a valid filetype for the given filename. The most simple format will just assume a filetype of binary. This method is available for the interface to make an intelligent first guess as to the filetype.- Specified by:
getSuggestedFiletype
in classFormattedDisk
-
getFiletypes
public java.lang.String[] getFiletypes()
Returns a list of possible file types. Since the filetype is specific to each operating system, a simple String is used.- Specified by:
getFiletypes
in classFormattedDisk
-
needsAddress
public boolean needsAddress(java.lang.String filetype)
Indicates if this filetype requires an address component. No Pascal filetypes require or support an address.- Specified by:
needsAddress
in classFormattedDisk
-
supportsDiskMap
public boolean supportsDiskMap()
Indicates if this FormattedDisk supports a disk map.- Overrides:
supportsDiskMap
in classFormattedDisk
-
changeImageOrder
public void changeImageOrder(ImageOrder imageOrder)
Change to a different ImageOrder. Remains in Pascal format but the underlying order can change.- Specified by:
changeImageOrder
in classFormattedDisk
- See Also:
ImageOrder
-
setFileData
public void setFileData(FileEntry fileEntry, byte[] fileData) throws DiskFullException
Writes the raw bytes into the file. This bypasses any special formatting of the data (such as prepending the data with a length and/or an address). Typically, the FileEntry.setFileData method should be used.- Specified by:
setFileData
in classFormattedDisk
- Throws:
DiskFullException
-
createDirectory
public DirectoryEntry createDirectory(java.lang.String name) throws DiskFullException
Create a new DirectoryEntry.- Throws:
DiskFullException
- See Also:
DirectoryEntry.createDirectory(String)
-
getDiskGeometry
public DiskGeometry getDiskGeometry()
Gives an indication on how this disk's geometry should be handled.- Specified by:
getDiskGeometry
in classFormattedDisk
-
fromProdosFiletype
public java.lang.String fromProdosFiletype(java.lang.String prodosFiletype)
Provides conversation from a given ProDOS file type since as it is common across many archiving tools.- Specified by:
fromProdosFiletype
in classFormattedDisk
-
toProdosFiletype
public java.lang.String toProdosFiletype(java.lang.String nativeFiletype)
Provides conversation to a given ProDOS file type since as it is common across many archiving tools.- Specified by:
toProdosFiletype
in classFormattedDisk
-
-