Package com.perforce.p4java.io.apple
Class AppleFile
- java.lang.Object
-
- com.perforce.p4java.io.apple.AppleFile
-
- Direct Known Subclasses:
AppleFileDecoder,AppleFileEncoder
public abstract class AppleFile extends java.lang.ObjectThis 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classAppleFile.FileDatesInfoEntryThis class represents the file dates.static classAppleFile.FileFormatThe Apple file format.
-
Field Summary
Fields Modifier and Type Field Description protected AppleFileDataafpFileInfoEntry 14: AFP file information, attributes, and so on.protected AppleFileDatacommentEntry 4: Standard Macintosh comment.protected AppleFileDatadataForkEntry 1: Data fork.protected AppleFileDatadirectoryIDEntry 15: AFP directory ID.protected AppleFileDatafileDataThe raw Apple file.protected AppleFileDatafileDatesInfoEntry 8: File creation date, modification date, and so on.protected AppleFile.FileDatesInfoEntryfileDatesInfoEntryThe file dates info entry.protected AppleFileDatafinderInfoEntry 9: Standard Macintosh Finder information.protected AppleFile.FileFormatformatThe Apple file format: AppleSingle, AppleDouble, default to unknown.protected AppleFileDataiconBWEntry 5: Standard Macintosh black and white icon.protected AppleFileDataiconColorEntry 6: Macintosh color icon.protected AppleFileDatamacintoshInfoEntry 10: Macintosh file information, attributes, and so on.protected AppleFileDatamsDOSFileInfoEntry 12: MS-DOS file information, attributes, and so on.protected intnumEntriesThe num entries.protected AppleFileDataproDOSFileInfoEntry 11: ProDOS file information, attributes, and so on.protected AppleFileDatarealNameEntry 3: File's name as created on home file system.protected AppleFileDataresourceForkEntry 2: Resource fork.protected AppleFileDatashortNameEntry 13: AFP short name.
-
Constructor Summary
Constructors Constructor Description AppleFile()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidextractFileDates(byte[] data, int offset, int length)Extract file dates.AppleFileDatagetAfpFileInfo()Gets the afp file info.AppleFileDatagetComment()Gets the comment.AppleFileDatagetDataFork()Gets the data fork.AppleFileDatagetDirectoryID()Gets the directory id.AppleFileDatagetFileData()Gets the file data.AppleFileDatagetFileDatesInfo()Gets the file dates info.AppleFileDatagetFinderInfo()Gets the finder info.AppleFile.FileFormatgetFormat()Gets the format.AppleFileDatagetIconBW()Gets the icon bw.AppleFileDatagetIconColor()Gets the icon color.AppleFileDatagetMacintoshInfo()Gets the macintosh info.AppleFileDatagetMsDOSFileInfo()Gets the ms dos file info.intgetNumEntries()Gets the num entries.AppleFileDatagetProDOSFileInfo()Gets the pro dos file info.AppleFileDatagetRealName()Gets the real name.AppleFileDatagetResourceFork()Gets the resource fork.AppleFileDatagetShortName()Gets the short name.voidsetAfpFileInfo(AppleFileData afpFileInfo)Sets the afp file info.voidsetComment(AppleFileData comment)Sets the comment.voidsetDataFork(AppleFileData dataFork)Sets the data fork.voidsetDirectoryID(AppleFileData directoryID)Sets the directory id.voidsetFileData(AppleFileData fileData)Sets the file data.voidsetFileDatesInfo(AppleFileData fileDatesInfo)Sets the file dates info.voidsetFinderInfo(AppleFileData finderInfo)Sets the finder info.voidsetFormat(AppleFile.FileFormat format)Sets the format.voidsetIconBW(AppleFileData iconBW)Sets the icon bw.voidsetIconColor(AppleFileData iconColor)Sets the icon color.voidsetMacintoshInfo(AppleFileData macintoshInfo)Sets the macintosh info.voidsetMsDOSFileInfo(AppleFileData msDOSFileInfo)Sets the ms dos file info.voidsetNumEntries(int numEntries)Sets the num entries.voidsetProDOSFileInfo(AppleFileData proDOSFileInfo)Sets the pro dos file info.voidsetRealName(AppleFileData realName)Sets the real name.voidsetResourceFork(AppleFileData resourceFork)Sets the resource fork.voidsetShortName(AppleFileData shortName)Sets the short name.protected voidverify()Verify the validity of the Apple file.
-
-
-
Field Detail
-
format
protected AppleFile.FileFormat format
The Apple file format: AppleSingle, AppleDouble, default to unknown.
-
fileData
protected AppleFileData fileData
The raw Apple file.
-
dataFork
protected AppleFileData dataFork
Entry 1: Data fork.
-
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.
-
fileDatesInfoEntry
protected AppleFile.FileDatesInfoEntry fileDatesInfoEntry
The file dates info entry.
-
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.
-
-
Method Detail
-
setNumEntries
public void setNumEntries(int numEntries)
Sets the num entries.- Parameters:
numEntries- the new num entries
-
verify
protected void verify() throws FileDecoderExceptionVerify the validity of the Apple file.- Throws:
FileDecoderException- the file decoder exception
-
extractFileDates
protected void extractFileDates(byte[] data, int offset, int length)Extract file dates.- Parameters:
data- the dataoffset- the offsetlength- the length
-
getFormat
public AppleFile.FileFormat getFormat()
Gets the format.- Returns:
- the format
-
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
-
-