Class AppleFile

  • Direct Known Subclasses:
    AppleFileDecoder, AppleFileEncoder

    public abstract class AppleFile
    extends java.lang.Object
    This abstract class handles AppleSingle/Double files. It contains a common method to verify the Apple file, and figure out if it is an AppleSingle or AppleDouble formatted file.

    The AppleSingle format is a representation of Macintosh files as one consecutive stream of bytes. AppleSingle combines the data fork, resource fork and the related Finder meta-file information into a single file.

    The AppleDouble format stores the data fork, resource fork as two separate files. AppleDouble leaves the data fork in its original format, and the resource fork and Finder information were combined into a second file.

    Apple defined the magic number for the AppleSingle format as 0x00051600, and the magic number for the AppleDouble format as 0x00051607.

     AppleSingle file header:
    
     Field Length
     ----- ------
     Magic number -------- 4 bytes
     Version number ------ 4 bytes
     Filler ------------- 16 bytes
     Number of entries --- 2 bytes
    
     Entry descriptor for each entry:
     Entry ID ------ 4 bytes
     Offset -------- 4 bytes
     Length -------- 4 bytes
    
     Apple reserved entry IDs:
    
     Data Fork -------------- 1 Data fork
     Resource Fork ---------- 2 Resource fork
     Real Name -------------- 3 File's name as created on home file system
     Comment ---------------- 4 Standard Macintosh comment
     Icon, B and W ---------- 5 Standard Macintosh black and white icon
     Icon, Color ------------ 6 Macintosh color icon
     File Dates Info -------- 8 File creation date, modification date, and so on
     Finder Info ------------ 9 Standard Macintosh Finder information
     Macintosh File Info --- 10 Macintosh file information, attributes, and so on
     ProDOS File Info ------ 11 ProDOS file information, attributes, and so on
     MS-DOS File Info ------ 12 MS-DOS file information, attributes, and so on
     Short Name ------------ 13 AFP short name
     AFP File Info --------- 14 AFP file information, attributes, and so on
     Directory ID ---------- 15 AFP directory ID
     

    See RFC 1740 for reference: http://tools.ietf.org/html/rfc1740

    • Field Detail

      • format

        protected AppleFile.FileFormat format
        The Apple file format: AppleSingle, AppleDouble, default to unknown.
      • resourceFork

        protected AppleFileData resourceFork
        Entry 2: Resource fork.
      • realName

        protected AppleFileData realName
        Entry 3: File's name as created on home file system.
      • comment

        protected AppleFileData comment
        Entry 4: Standard Macintosh comment.
      • iconBW

        protected AppleFileData iconBW
        Entry 5: Standard Macintosh black and white icon.
      • iconColor

        protected AppleFileData iconColor
        Entry 6: Macintosh color icon.
      • fileDatesInfo

        protected AppleFileData fileDatesInfo
        Entry 8: File creation date, modification date, and so on.
      • finderInfo

        protected AppleFileData finderInfo
        Entry 9: Standard Macintosh Finder information.
      • macintoshInfo

        protected AppleFileData macintoshInfo
        Entry 10: Macintosh file information, attributes, and so on.
      • proDOSFileInfo

        protected AppleFileData proDOSFileInfo
        Entry 11: ProDOS file information, attributes, and so on.
      • msDOSFileInfo

        protected AppleFileData msDOSFileInfo
        Entry 12: MS-DOS file information, attributes, and so on.
      • shortName

        protected AppleFileData shortName
        Entry 13: AFP short name.
      • afpFileInfo

        protected AppleFileData afpFileInfo
        Entry 14: AFP file information, attributes, and so on.
      • directoryID

        protected AppleFileData directoryID
        Entry 15: AFP directory ID.
      • numEntries

        protected int numEntries
        The num entries.
    • Constructor Detail

      • AppleFile

        public AppleFile()
    • Method Detail

      • setNumEntries

        public void setNumEntries​(int numEntries)
        Sets the num entries.
        Parameters:
        numEntries - the new num entries
      • extractFileDates

        protected void extractFileDates​(byte[] data,
                                        int offset,
                                        int length)
        Extract file dates.
        Parameters:
        data - the data
        offset - the offset
        length - the length
      • setFormat

        public void setFormat​(AppleFile.FileFormat format)
        Sets the format.
        Parameters:
        format - the new format
      • getFileData

        public AppleFileData getFileData()
        Gets the file data.
        Returns:
        the file data
      • setFileData

        public void setFileData​(AppleFileData fileData)
        Sets the file data.
        Parameters:
        fileData - the new file data
      • getDataFork

        public AppleFileData getDataFork()
        Gets the data fork.
        Returns:
        the data fork
      • setDataFork

        public void setDataFork​(AppleFileData dataFork)
        Sets the data fork.
        Parameters:
        dataFork - the new data fork
      • getResourceFork

        public AppleFileData getResourceFork()
        Gets the resource fork.
        Returns:
        the resource fork
      • setResourceFork

        public void setResourceFork​(AppleFileData resourceFork)
        Sets the resource fork.
        Parameters:
        resourceFork - the new resource fork
      • getRealName

        public AppleFileData getRealName()
        Gets the real name.
        Returns:
        the real name
      • setRealName

        public void setRealName​(AppleFileData realName)
        Sets the real name.
        Parameters:
        realName - the new real name
      • getComment

        public AppleFileData getComment()
        Gets the comment.
        Returns:
        the comment
      • setComment

        public void setComment​(AppleFileData comment)
        Sets the comment.
        Parameters:
        comment - the new comment
      • getIconBW

        public AppleFileData getIconBW()
        Gets the icon bw.
        Returns:
        the icon bw
      • setIconBW

        public void setIconBW​(AppleFileData iconBW)
        Sets the icon bw.
        Parameters:
        iconBW - the new icon bw
      • getIconColor

        public AppleFileData getIconColor()
        Gets the icon color.
        Returns:
        the icon color
      • setIconColor

        public void setIconColor​(AppleFileData iconColor)
        Sets the icon color.
        Parameters:
        iconColor - the new icon color
      • getFileDatesInfo

        public AppleFileData getFileDatesInfo()
        Gets the file dates info.
        Returns:
        the file dates info
      • setFileDatesInfo

        public void setFileDatesInfo​(AppleFileData fileDatesInfo)
        Sets the file dates info.
        Parameters:
        fileDatesInfo - the new file dates info
      • getFinderInfo

        public AppleFileData getFinderInfo()
        Gets the finder info.
        Returns:
        the finder info
      • setFinderInfo

        public void setFinderInfo​(AppleFileData finderInfo)
        Sets the finder info.
        Parameters:
        finderInfo - the new finder info
      • getMacintoshInfo

        public AppleFileData getMacintoshInfo()
        Gets the macintosh info.
        Returns:
        the macintosh info
      • setMacintoshInfo

        public void setMacintoshInfo​(AppleFileData macintoshInfo)
        Sets the macintosh info.
        Parameters:
        macintoshInfo - the new macintosh info
      • getProDOSFileInfo

        public AppleFileData getProDOSFileInfo()
        Gets the pro dos file info.
        Returns:
        the pro dos file info
      • setProDOSFileInfo

        public void setProDOSFileInfo​(AppleFileData proDOSFileInfo)
        Sets the pro dos file info.
        Parameters:
        proDOSFileInfo - the new pro dos file info
      • getMsDOSFileInfo

        public AppleFileData getMsDOSFileInfo()
        Gets the ms dos file info.
        Returns:
        the ms dos file info
      • setMsDOSFileInfo

        public void setMsDOSFileInfo​(AppleFileData msDOSFileInfo)
        Sets the ms dos file info.
        Parameters:
        msDOSFileInfo - the new ms dos file info
      • getShortName

        public AppleFileData getShortName()
        Gets the short name.
        Returns:
        the short name
      • setShortName

        public void setShortName​(AppleFileData shortName)
        Sets the short name.
        Parameters:
        shortName - the new short name
      • getAfpFileInfo

        public AppleFileData getAfpFileInfo()
        Gets the afp file info.
        Returns:
        the afp file info
      • setAfpFileInfo

        public void setAfpFileInfo​(AppleFileData afpFileInfo)
        Sets the afp file info.
        Parameters:
        afpFileInfo - the new afp file info
      • getDirectoryID

        public AppleFileData getDirectoryID()
        Gets the directory id.
        Returns:
        the directory id
      • setDirectoryID

        public void setDirectoryID​(AppleFileData directoryID)
        Sets the directory id.
        Parameters:
        directoryID - the new directory id
      • getNumEntries

        public int getNumEntries()
        Gets the num entries.
        Returns:
        the num entries