Class PascalDirectory

java.lang.Object
org.applecommander.os.pascal.PascalDirectory
All Implemented Interfaces:
Directory, WritableDirectory, PascalConstants

public class PascalDirectory extends Object implements WritableDirectory, PascalConstants
  • Method Details

    • readEntry

      public DataBuffer readEntry()
    • modifyEntry

      public void modifyEntry(Consumer<DataBuffer> consumer)
    • getFileStore

      public PascalFileStore getFileStore()
      Returns the FileStore that this Directory belongs to.
      Specified by:
      getFileStore in interface Directory
    • getName

      public String getName()
      Returns the name of this directory.
      Specified by:
      getName in interface Directory
    • setName

      public void setName(String name)

      Sets the name of this directory. Per the Apple Pascal documentation:

      A diskette's volume name must be seven or fewer characters long and may not contain an equals sign (=), dollar sign ($), question mark (?) or comma(,).

      This method only errors if, after applying the rules, the string is empty.

    • getBlocksOnDisk

      public int getBlocksOnDisk()
    • getFilesOnDisk

      public int getFilesOnDisk()
    • updateFilesOnDisk

      public void updateFilesOnDisk(int modifier)
    • getMostRecentDate

      public Date getMostRecentDate()
    • setMostRecentDate

      public void setMostRecentDate(Date date)
    • getFiles

      public List<FileEntry> getFiles()
      Return all entries that are stored in this directory.
      Specified by:
      getFiles in interface Directory
    • createFile

      public PascalFileEntry createFile(String fileName)
      Create a file. By definition, any file created is a WritableFileEntry.
      Specified by:
      createFile in interface WritableDirectory
      See Also:
    • createFrom

      public PascalFileEntry createFrom(ProdosAttributes prodosAttributes)
      Create a file given the supplied ProDOS attributes. This is expected to handle setting all appropriate FileEntry attributes that align. File type should be converted, dates applied, etc.
      Specified by:
      createFrom in interface WritableDirectory
      See Also:
    • deleteFile

      public void deleteFile(FileEntry fileEntry)
      Delete a Pascal file. Pascal does not mark a file as delete, it simply removes the entry. This logic copies all data after into this position. Note that, regardless, any existing PascalFileEntry objects are invalid since their offset will be incorrect.
      Specified by:
      deleteFile in interface WritableDirectory
      See Also: