Class 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

  • Field Details

    • TRACK_LOCATION_INDEX

      public static final int TRACK_LOCATION_INDEX
      Indicates the index of the track in the location array.
      See Also:
    • SECTOR_LOCATION_INDEX

      public static final int SECTOR_LOCATION_INDEX
      Indicates the index of the sector in the location array.
      See Also:
    • CATALOG_TRACK

      public static final int CATALOG_TRACK
      The catalog track.
      See Also:
    • VTOC_SECTOR

      public static final int VTOC_SECTOR
      The VTOC sector.
      See Also:
    • TRACK_SECTOR_PAIRS

      public static final int TRACK_SECTOR_PAIRS
      The standard track/sector pairs in a track/sector list.
      See Also:
  • Constructor Details

    • NakedosFormatDisk

      public NakedosFormatDisk(String filename, ImageOrder imageOrder)
      ) Constructor for NakedosFormatDisk.
  • Method Details

    • create

      public static NakedosFormatDisk[] create(String filename, ImageOrder imageOrder)
      Create a NakedosFormatDisk. All DOS disk images are expected to be 140K in size.
    • getFormat

      public String getFormat()
      Identify the operating system format of this disk as Nakedos.
      Specified by:
      getFormat in class FormattedDisk
      See Also:
    • getFiles

      public List<FileEntry> getFiles()
      Retrieve a list of files.
      See Also:
    • 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:
      getFreeSpace in class FormattedDisk
      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:
      getUsedSpace in class FormattedDisk
      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

      public String getDiskName()
      Return the disk name.
      Specified by:
      getDiskName in class FormattedDisk
      See Also:
    • 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:
      getDiskUsage in class FormattedDisk
    • 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:
      getBitmapDimensions in class FormattedDisk
      See Also:
    • getBitmapLength

      public int getBitmapLength()
      Get the length of the bitmap.
      Specified by:
      getBitmapLength in class FormattedDisk
    • getBitmapLabels

      public String[] getBitmapLabels()
      Get the labels to use in the bitmap.
      Specified by:
      getBitmapLabels in class FormattedDisk
    • getDiskInformation

      public List<FormattedDisk.DiskInformation> getDiskInformation()
      Get WP-specific disk information.
      Overrides:
      getDiskInformation in class FormattedDisk
    • getFileColumnHeaders

      public 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 class FormattedDisk
    • supportsDeletedFiles

      public boolean supportsDeletedFiles()
      Indicates if this disk format supports "deleted" files.
      Specified by:
      supportsDeletedFiles in class FormattedDisk
    • canReadFileData

      public boolean canReadFileData()
      Indicates if this disk image can read data from a file.
      Specified by:
      canReadFileData in class FormattedDisk
    • canWriteFileData

      public boolean canWriteFileData()
      Indicates if this disk image can write data to a file.
      Specified by:
      canWriteFileData in class FormattedDisk
    • canHaveDirectories

      public boolean canHaveDirectories()
      Identify if this disk format as not capable of having directories.
      Specified by:
      canHaveDirectories in class FormattedDisk
      See Also:
    • canDeleteFile

      public boolean canDeleteFile()
      Indicates if this disk image can delete a file.
      Specified by:
      canDeleteFile in class FormattedDisk
    • getFileData

      public byte[] getFileData(FileEntry fileEntry)
      Get the data associated with the specified FileEntry.
      Specified by:
      getFileData in class FormattedDisk
      See Also:
    • 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 class FormattedDisk
      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:
      format in class FormattedDisk
      See Also:
    • 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:
      getLogicalDiskNumber in class FormattedDisk
    • getSuggestedFilename

      public String getSuggestedFilename(String filename)
      Returns a valid filename for the given filename.
      Specified by:
      getSuggestedFilename in class FormattedDisk
    • getSuggestedFiletype

      public String getSuggestedFiletype(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 class FormattedDisk
    • getFiletypes

      public 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 class FormattedDisk
    • needsAddress

      public boolean needsAddress(String filetype)
      Indicates if this filetype requires an address component. For DOS, only the Binary type needs an address.
      Specified by:
      needsAddress in class FormattedDisk
    • supportsDiskMap

      public boolean supportsDiskMap()
      Indicates if this FormattedDisk supports a disk map.
      Overrides:
      supportsDiskMap in class FormattedDisk
    • 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:
      changeImageOrder in class FormattedDisk
      See Also:
    • createDirectory

      public DirectoryEntry createDirectory(String name) throws DiskFullException
      Create a new DirectoryEntry.
      Throws:
      DiskFullException
      See Also:
    • getDiskGeometry

      public DiskGeometry getDiskGeometry()
      Gives an indication on how this disk's geometry should be handled.
      Specified by:
      getDiskGeometry in class FormattedDisk
    • toNativeFiletype

      public String toNativeFiletype(String prodosFiletype)
      Provides conversation from a given ProDOS file type since as it is common across many archiving tools.
      Specified by:
      toNativeFiletype in class FormattedDisk
    • toProdosFiletype

      public String toProdosFiletype(String nativeFiletype)
      Provides conversation to a given ProDOS file type since as it is common across many archiving tools.
      Specified by:
      toProdosFiletype in class FormattedDisk