Class NakedosFormatDisk
- java.lang.Object
-
- com.webcodepro.applecommander.storage.Disk
-
- com.webcodepro.applecommander.storage.FormattedDisk
-
- com.webcodepro.applecommander.storage.os.nakedos.NakedosFormatDisk
-
- All Implemented Interfaces:
DirectoryEntry
public class NakedosFormatDisk extends FormattedDisk
Manages a disk that is in NakedOS format.Date created: August 5, 2010 10:23:23 AM
-
-
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 intCATALOG_TRACKThe catalog track.static intSECTOR_LOCATION_INDEXIndicates the index of the sector in the location array.static intTRACK_LOCATION_INDEXIndicates the index of the track in the location array.static intTRACK_SECTOR_PAIRSThe standard track/sector pairs in a track/sector list.static intVTOC_SECTORThe VTOC sector.-
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 NakedosFormatDisk(java.lang.String filename, ImageOrder imageOrder)) Constructor for NakedosFormatDisk.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanCreateDirectories()Identify if additional directories can be created.booleancanCreateFile()Indicates if this disk image can create a file.booleancanDeleteFile()Indicates if this disk image can delete a file.booleancanHaveDirectories()Identify if this disk format as not capable of having directories.booleancanReadFileData()Indicates if this disk image can read data from a file.booleancanWriteFileData()Indicates if this disk image can write data to a file.voidchangeImageOrder(ImageOrder imageOrder)Change to a different ImageOrder.protected voidcheckRange(int track, int sector)Validate track/sector range.static NakedosFormatDisk[]create(java.lang.String filename, ImageOrder imageOrder)Create a NakedosFormatDisk.DirectoryEntrycreateDirectory(java.lang.String name)Create a new DirectoryEntry.FileEntrycreateFile()Create a FileEntry.voidformat()Format the disk as DOS 3.3.protected voidformat(int tracksPerDisk, int sectorsPerTrack)Format the disk as NakedOS.int[]getBitmapDimensions()Get suggested dimensions for display of bitmap.java.lang.String[]getBitmapLabels()Get the labels to use in the bitmap.intgetBitmapLength()Get the length of the bitmap.DiskGeometrygetDiskGeometry()Gives an indication on how this disk's geometry should be handled.java.util.List<FormattedDisk.DiskInformation>getDiskInformation()Get WP-specific disk information.java.lang.StringgetDiskName()Return the disk name.FormattedDisk.DiskUsagegetDiskUsage()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.java.lang.String[]getFiletypes()Returns a list of possible file types.java.lang.StringgetFormat()Identify the operating system format of this disk as Nakedos.intgetFreeSectors()Compute the number of free sectors available on the disk.intgetFreeSpace()Compute the amount of freespace available on the disk.intgetLogicalDiskNumber()Returns the logical disk number.intgetSectors()Get the number of sectors on this disk.java.lang.StringgetSuggestedFilename(java.lang.String filename)Returns a valid filename for the given filename.java.lang.StringgetSuggestedFiletype(java.lang.String filename)Returns a valid filetype for the given filename.intgetTotalSectors()Compute the total number of sectors available on the disk.intgetTracks()Get the number of tracks on this disk.intgetUsedSectors()Compute the number of used sectors on the disk.intgetUsedSpace()Return the amount of used space in bytes.booleanneedsAddress(java.lang.String filetype)Indicates if this filetype requires an address component.protected byte[]readVtoc()Return the VTOC (Volume Table Of Contents).voidsetFileData(FileEntry fileEntry, byte[] fileData)Writes the raw bytes into the file.protected voidsetFileData(NakedosFileEntry fileEntry, byte[] data)Set the data associated with the specified NakedosFileEntry into sectors on the disk.booleansupportsDeletedFiles()Indicates if this disk format supports "deleted" files.booleansupportsDiskMap()Indicates if this FormattedDisk supports a disk map.protected voidwriteVtoc(byte[] vtoc)Save the VTOC (Volume Table Of Contents) to disk.-
Methods inherited from class com.webcodepro.applecommander.storage.FormattedDisk
getFile, getFile, getFormattedDisk, resizeDiskImage, setDiskName, 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, isRdosFormat, isSDK, isSHK, isUniDosFormat, isWPFormat, makeDosOrder, makeProdosOrder, readBlock, readSector, resizeDiskImage, save, saveAs, setFilename, setImageOrder, sizeToFit, testImageOrder, writeBlock, writeSector
-
-
-
-
Field Detail
-
TRACK_LOCATION_INDEX
public static final int TRACK_LOCATION_INDEX
Indicates the index of the track in the location array.- See Also:
- Constant Field Values
-
SECTOR_LOCATION_INDEX
public static final int SECTOR_LOCATION_INDEX
Indicates the index of the sector in the location array.- See Also:
- Constant Field Values
-
CATALOG_TRACK
public static final int CATALOG_TRACK
The catalog track.- See Also:
- Constant Field Values
-
VTOC_SECTOR
public static final int VTOC_SECTOR
The VTOC sector.- See Also:
- Constant Field Values
-
TRACK_SECTOR_PAIRS
public static final int TRACK_SECTOR_PAIRS
The standard track/sector pairs in a track/sector list.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
NakedosFormatDisk
public NakedosFormatDisk(java.lang.String filename, ImageOrder imageOrder)) Constructor for NakedosFormatDisk.
-
-
Method Detail
-
create
public static NakedosFormatDisk[] create(java.lang.String filename, ImageOrder imageOrder)
Create a NakedosFormatDisk. All DOS disk images are expected to be 140K in size.
-
getFormat
public java.lang.String getFormat()
Identify the operating system format of this disk as Nakedos.- Specified by:
getFormatin classFormattedDisk- See Also:
FormattedDisk.getFormat()
-
getFiles
public java.util.List<FileEntry> getFiles()
Retrieve a list of files.- See Also:
DirectoryEntry.getFiles()
-
createFile
public FileEntry createFile() throws DiskFullException
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:
FormattedDisk.getFreeSpace()
-
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:
FormattedDisk.getUsedSpace()
-
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
public java.lang.String getDiskName()
Return the disk name.- Specified by:
getDiskNamein classFormattedDisk- See Also:
FormattedDisk.getDiskName()
-
readVtoc
protected byte[] readVtoc()
Return the VTOC (Volume Table Of Contents).
-
writeVtoc
protected void writeVtoc(byte[] vtoc)
Save the VTOC (Volume Table Of Contents) to disk.
-
getDiskUsage
public FormattedDisk.DiskUsage 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:
FormattedDisk.getBitmapDimensions()
-
getBitmapLength
public int getBitmapLength()
Get the length of the bitmap.- Specified by:
getBitmapLengthin classFormattedDisk
-
getBitmapLabels
public java.lang.String[] getBitmapLabels()
Get the labels to use in the bitmap.- Specified by:
getBitmapLabelsin classFormattedDisk
-
getDiskInformation
public java.util.List<FormattedDisk.DiskInformation> getDiskInformation()
Get WP-specific disk information.- Overrides:
getDiskInformationin 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:
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:
FormattedDisk.canHaveDirectories()
-
canDeleteFile
public boolean canDeleteFile()
Indicates if this disk image can delete a file.- Specified by:
canDeleteFilein classFormattedDisk
-
getFileData
public byte[] getFileData(FileEntry fileEntry)
Get the data associated with the specified FileEntry.- Specified by:
getFileDatain classFormattedDisk- See Also:
FileEntry.getFileData()
-
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:
setFileDatain classFormattedDisk- Throws:
DiskFullException
-
setFileData
protected void setFileData(NakedosFileEntry fileEntry, byte[] data) throws DiskFullException
Set the data associated with the specified NakedosFileEntry into sectors on the disk.- Throws:
DiskFullException
-
format
public void format()
Format the disk as DOS 3.3.- Specified by:
formatin classFormattedDisk- See Also:
FormattedDisk.format()
-
format
protected void format(int tracksPerDisk, int sectorsPerTrack)Format the disk as NakedOS.
-
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
public java.lang.String getSuggestedFilename(java.lang.String filename)
Returns a valid filename for the given filename.- Specified by:
getSuggestedFilenamein 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:
getSuggestedFiletypein 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:
getFiletypesin classFormattedDisk
-
needsAddress
public boolean needsAddress(java.lang.String filetype)
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
-
changeImageOrder
public void changeImageOrder(ImageOrder imageOrder)
Change to a different ImageOrder. Remains in DOS 3.3 format but the underlying order can change.- Specified by:
changeImageOrderin classFormattedDisk- See Also:
ImageOrder
-
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:
getDiskGeometryin classFormattedDisk
-
-