Class DosFormatDisk
java.lang.Object
com.webcodepro.applecommander.storage.FormattedDisk
com.webcodepro.applecommander.storage.os.dos33.DosFormatDisk
- All Implemented Interfaces:
DirectoryEntry,Container
Manages a disk that is in Apple DOS 3.3 format.
Date created: Oct 4, 2002 12:29:23 AM
-
Nested Class Summary
Nested classes/interfaces inherited from class com.webcodepro.applecommander.storage.FormattedDisk
FormattedDisk.DiskInformation, FormattedDisk.DiskUsage, FormattedDisk.FileColumnHeader -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe standard DOS 3.3 catalog track.static final intIndicates the index of the sector in the location array.static final intIndicates the index of the track in the location array.static final intThe standard track/sector pairs in a track/sector list.static final intThe standard VTOC sector.Fields inherited from class com.webcodepro.applecommander.storage.FormattedDisk
FILE_DISPLAY_DETAIL, FILE_DISPLAY_NATIVE, FILE_DISPLAY_STANDARD -
Constructor Summary
ConstructorsConstructorDescriptionDosFormatDisk(String filename, TrackSectorDevice device, int catalogTrack) Constructor for DosFormatDisk. -
Method Summary
Modifier and TypeMethodDescriptionbooleanIdentify if additional directories can be created.booleanIndicates if this disk image can create a file.booleanIndicates if this disk image can delete a file.booleanIdentify if this disk format as not capable of having directories.booleanIndicates if this disk image can read data from a file.booleanIndicates if this disk image can write data to a file.protected voidcheckRange(int track, int sector) Validate track/sector range.static DosFormatDisk[]create(String filename, BlockDevice device, TrackSectorToBlockStrategy... strategies) Create a DosFormatDisk on 800K image.static DosFormatDisk[]create(String filename, TrackSectorDevice device) Create a DosFormatDisk.createDirectory(String name) Create a new DirectoryEntry.Create a FileEntry.voidformat()Format the disk as DOS 3.3.protected voidfreeSectors(DosFileEntry dosFileEntry) Free sectors used by a DosFileEntry.<T> Optional<T> int[]Get suggested dimensions for display of bitmap.String[]Get the labels to use in the bitmap.intGet the length of the bitmap.Gives an indication on how this disk's geometry should be handled.Get DOS-specific disk information.Return the DOS disk name.Get the disk usage iterator.getFileColumnHeaders(int displayMode) Get the standard file column header information.byte[]getFileData(FileEntry fileEntry) Get the data associated with the specified FileEntry.getFiles()Retrieve a list of files.String[]Returns a list of possible file types.Identify the operating system format of this disk as DOS 3.x.protected intgetFreeMapBit(int sector) Compute the VTOC bit for the T/S map.protected intgetFreeMapByte(int track, int sector) Compute the VTOC byte for the T/S map.intCompute the number of free sectors available on the disk.intCompute the amount of freespace available on the disk.intReturns the logical disk number.intGet the number of sectors on this disk.getSuggestedFilename(String filename) Returns a valid filename for the given filename.getSuggestedFiletype(String filename) Returns a valid filetype for the given filename.intCompute the total number of sectors available on the disk.intGet the number of tracks on this disk.intCompute the number of used sectors on the disk.intReturn the amount of used space in bytes.booleanisSectorFree(int track, int sector, byte[] vtoc) Indicates if a specific track/sector is free.booleanisSectorUsed(int track, int sector, byte[] vtoc) Indicates if a specific track/sector is used.booleanneedsAddress(String filetype) Indicates if this filetype requires an address component.byte[]readVtoc()Return the VTOC (Volume Table Of Contents).voidsetFileData(FileEntry fileEntry, byte[] fileData) Writes the raw bytes into the file.protected voidsetFileData(DosFileEntry fileEntry, byte[] data) Set the data associated with the specified DosFileEntry into sectors on the disk.voidsetSectorFree(int track, int sector, byte[] vtoc) Sets the track/sector indicator to free.voidsetSectorUsed(int track, int sector, byte[] vtoc) Sets the track/sector indicator to used.booleanIndicates if this disk format supports "deleted" files.booleanIndicates if this FormattedDisk supports a disk map.toNativeFiletype(String prodosFiletype) Provides conversation from a given ProDOS file type since as it is common across many archiving tools.toProdosFiletype(String nativeFiletype) Provides conversation to a given ProDOS file type since as it is common across many archiving tools.voidwriteVtoc(byte[] vtoc) Save the VTOC (Volume Table Of Contents) to disk.Methods inherited from class com.webcodepro.applecommander.storage.FormattedDisk
getBootCode, getDirname, getFile, getFile, getFilename, getFormattedDisk, getSource, hasChanged, isNewImage, resizeDiskImage, resizeDiskImage, save, saveAs, setDiskName, setFilename
-
Field Details
-
TRACK_LOCATION_INDEX
public static final int TRACK_LOCATION_INDEXIndicates the index of the track in the location array.- See Also:
-
SECTOR_LOCATION_INDEX
public static final int SECTOR_LOCATION_INDEXIndicates the index of the sector in the location array.- See Also:
-
CATALOG_TRACK
public static final int CATALOG_TRACKThe standard DOS 3.3 catalog track.- See Also:
-
VTOC_SECTOR
public static final int VTOC_SECTORThe standard VTOC sector.- See Also:
-
TRACK_SECTOR_PAIRS
public static final int TRACK_SECTOR_PAIRSThe standard track/sector pairs in a track/sector list.- See Also:
-
-
Constructor Details
-
DosFormatDisk
Constructor for DosFormatDisk.
-
-
Method Details
-
get
-
create
Create a DosFormatDisk. All DOS disk images are expected to be 140K in size. -
create
public static DosFormatDisk[] create(String filename, BlockDevice device, TrackSectorToBlockStrategy... strategies) Create a DosFormatDisk on 800K image. Note that we allow the BlockDevice to be passed in order to support 2IMG, DC, and PO images. -
getFormat
Identify the operating system format of this disk as DOS 3.x.- Specified by:
getFormatin classFormattedDisk- See Also:
-
getFiles
Retrieve a list of files.- Throws:
DiskException- See Also:
-
createFile
Create a 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 been implemented to something specific about the disk. -
getFreeSpace
public int getFreeSpace()Compute the amount of freespace available on the disk. This algorithm completely ignores tracks and sectors by running through the entire bitmap stored on the VTOC.- Specified by:
getFreeSpacein classFormattedDisk- See Also:
-
getFreeSectors
public int getFreeSectors()Compute the number of free sectors available on the disk. -
getUsedSpace
public int getUsedSpace()Return the amount of used space in bytes.- Specified by:
getUsedSpacein classFormattedDisk- See Also:
-
getUsedSectors
public int getUsedSectors()Compute the number of used sectors on the disk. -
getTotalSectors
public int getTotalSectors()Compute the total number of sectors available on the disk. -
getDiskName
Return the DOS disk name. Basically, the DISK VOLUME #xxx that a CATALOG command would show. Note that Java bytes are signed, so a little mojo is in order.- Specified by:
getDiskNamein classFormattedDisk- See Also:
-
readVtoc
public byte[] readVtoc()Return the VTOC (Volume Table Of Contents). -
writeVtoc
public void writeVtoc(byte[] vtoc) Save the VTOC (Volume Table Of Contents) to disk. -
getDiskUsage
Get the disk usage iterator.- Specified by:
getDiskUsagein classFormattedDisk
-
getTracks
public int getTracks()Get the number of tracks on this disk. -
getSectors
public int getSectors()Get the number of sectors on this disk. -
getBitmapDimensions
public int[] getBitmapDimensions()Get suggested dimensions for display of bitmap. For DOS 3.3, that information is stored in the VTOC, and that information is fairly important.- Specified by:
getBitmapDimensionsin classFormattedDisk- See Also:
-
getBitmapLength
public int getBitmapLength()Get the length of the bitmap.- Specified by:
getBitmapLengthin classFormattedDisk
-
getBitmapLabels
Get the labels to use in the bitmap.- Specified by:
getBitmapLabelsin classFormattedDisk
-
getDiskInformation
Get DOS-specific disk information.- Overrides:
getDiskInformationin classFormattedDisk
-
getFileColumnHeaders
Get the standard file column header information. This default implementation is intended only for standard mode.- Overrides:
getFileColumnHeadersin classFormattedDisk
-
supportsDeletedFiles
public boolean supportsDeletedFiles()Indicates if this disk format supports "deleted" files.- Specified by:
supportsDeletedFilesin classFormattedDisk
-
canReadFileData
public boolean canReadFileData()Indicates if this disk image can read data from a file.- Specified by:
canReadFileDatain classFormattedDisk
-
canWriteFileData
public boolean canWriteFileData()Indicates if this disk image can write data to a file.- Specified by:
canWriteFileDatain classFormattedDisk
-
canHaveDirectories
public boolean canHaveDirectories()Identify if this disk format as not capable of having directories.- Specified by:
canHaveDirectoriesin classFormattedDisk- See Also:
-
canDeleteFile
public boolean canDeleteFile()Indicates if this disk image can delete a file.- Specified by:
canDeleteFilein classFormattedDisk
-
getFileData
Get the data associated with the specified FileEntry.- Specified by:
getFileDatain classFormattedDisk- See Also:
-
setFileData
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:
setFileDatain classFormattedDisk- Throws:
DiskFullException
-
setFileData
Set the data associated with the specified DosFileEntry into sectors on the disk.- Throws:
DiskFullException
-
freeSectors
Free sectors used by a DosFileEntry. -
format
public void format()Format the disk as DOS 3.3.- Specified by:
formatin classFormattedDisk- See Also:
-
isSectorFree
public boolean isSectorFree(int track, int sector, byte[] vtoc) Indicates if a specific track/sector is free. -
isSectorUsed
public boolean isSectorUsed(int track, int sector, byte[] vtoc) Indicates if a specific track/sector is used. -
setSectorFree
public void setSectorFree(int track, int sector, byte[] vtoc) Sets the track/sector indicator to free. -
setSectorUsed
public void setSectorUsed(int track, int sector, byte[] vtoc) Sets the track/sector indicator to used. -
getFreeMapByte
protected int getFreeMapByte(int track, int sector) Compute the VTOC byte for the T/S map. -
getFreeMapBit
protected int getFreeMapBit(int sector) Compute the VTOC bit for the T/S map. -
checkRange
protected void checkRange(int track, int sector) Validate track/sector range. This just validates the maximum values allowable for track and sector. -
getLogicalDiskNumber
public int getLogicalDiskNumber()Returns the logical disk number. Returns a 0 to indicate no numbering.- Specified by:
getLogicalDiskNumberin classFormattedDisk
-
getSuggestedFilename
Returns a valid filename for the given filename. DOS 3.3 pretty much allows anything - so it is cut to 30 characters and trimmed (trailing whitespace may cause confusion).- Specified by:
getSuggestedFilenamein classFormattedDisk
-
getSuggestedFiletype
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:
getSuggestedFiletypein classFormattedDisk
-
getFiletypes
Returns a list of possible file types. Since the filetype is specific to each operating system, a simple String is used.- Specified by:
getFiletypesin classFormattedDisk
-
needsAddress
Indicates if this filetype requires an address component. For DOS, only the Binary type needs an address.- Specified by:
needsAddressin classFormattedDisk
-
supportsDiskMap
public boolean supportsDiskMap()Indicates if this FormattedDisk supports a disk map.- Overrides:
supportsDiskMapin classFormattedDisk
-
createDirectory
Create a new DirectoryEntry.- See Also:
-
getDiskGeometry
Gives an indication on how this disk's geometry should be handled.- Specified by:
getDiskGeometryin classFormattedDisk
-
toNativeFiletype
Provides conversation from a given ProDOS file type since as it is common across many archiving tools.- Specified by:
toNativeFiletypein classFormattedDisk
-
toProdosFiletype
Provides conversation to a given ProDOS file type since as it is common across many archiving tools.- Specified by:
toProdosFiletypein classFormattedDisk
-