Package com.perforce.p4java.io.apple
Class AppleFile
java.lang.Object
com.perforce.p4java.io.apple.AppleFile
- Direct Known Subclasses:
AppleFileDecoder,AppleFileEncoder
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassThis class represents the file dates.static enumThe Apple file format. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AppleFileDataEntry 14: AFP file information, attributes, and so on.protected AppleFileDataEntry 4: Standard Macintosh comment.protected AppleFileDataEntry 1: Data fork.protected AppleFileDataEntry 15: AFP directory ID.protected AppleFileDataThe raw Apple file.protected AppleFileDataEntry 8: File creation date, modification date, and so on.protected AppleFile.FileDatesInfoEntryThe file dates info entry.protected AppleFileDataEntry 9: Standard Macintosh Finder information.protected AppleFile.FileFormatThe Apple file format: AppleSingle, AppleDouble, default to unknown.protected AppleFileDataEntry 5: Standard Macintosh black and white icon.protected AppleFileDataEntry 6: Macintosh color icon.protected AppleFileDataEntry 10: Macintosh file information, attributes, and so on.protected AppleFileDataEntry 12: MS-DOS file information, attributes, and so on.protected intThe num entries.protected AppleFileDataEntry 11: ProDOS file information, attributes, and so on.protected AppleFileDataEntry 3: File's name as created on home file system.protected AppleFileDataEntry 2: Resource fork.protected AppleFileDataEntry 13: AFP short name. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidextractFileDates(byte[] data, int offset, int length) Extract file dates.Gets the afp file info.Gets the comment.Gets the data fork.Gets the directory id.Gets the file data.Gets the file dates info.Gets the finder info.Gets the format.Gets the icon bw.Gets the icon color.Gets the macintosh info.Gets the ms dos file info.intGets the num entries.Gets the pro dos file info.Gets the real name.Gets the resource fork.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 Details
-
format
The Apple file format: AppleSingle, AppleDouble, default to unknown. -
fileData
The raw Apple file. -
dataFork
Entry 1: Data fork. -
resourceFork
Entry 2: Resource fork. -
realName
Entry 3: File's name as created on home file system. -
comment
Entry 4: Standard Macintosh comment. -
iconBW
Entry 5: Standard Macintosh black and white icon. -
iconColor
Entry 6: Macintosh color icon. -
fileDatesInfo
Entry 8: File creation date, modification date, and so on. -
fileDatesInfoEntry
The file dates info entry. -
finderInfo
Entry 9: Standard Macintosh Finder information. -
macintoshInfo
Entry 10: Macintosh file information, attributes, and so on. -
proDOSFileInfo
Entry 11: ProDOS file information, attributes, and so on. -
msDOSFileInfo
Entry 12: MS-DOS file information, attributes, and so on. -
shortName
Entry 13: AFP short name. -
afpFileInfo
Entry 14: AFP file information, attributes, and so on. -
directoryID
Entry 15: AFP directory ID. -
numEntries
protected int numEntriesThe num entries.
-
-
Constructor Details
-
AppleFile
public AppleFile()
-
-
Method Details
-
setNumEntries
public void setNumEntries(int numEntries) Sets the num entries.- Parameters:
numEntries- the new num entries
-
verify
Verify 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
Gets the format.- Returns:
- the format
-
setFormat
Sets the format.- Parameters:
format- the new format
-
getFileData
Gets the file data.- Returns:
- the file data
-
setFileData
Sets the file data.- Parameters:
fileData- the new file data
-
getDataFork
Gets the data fork.- Returns:
- the data fork
-
setDataFork
Sets the data fork.- Parameters:
dataFork- the new data fork
-
getResourceFork
Gets the resource fork.- Returns:
- the resource fork
-
setResourceFork
Sets the resource fork.- Parameters:
resourceFork- the new resource fork
-
getRealName
Gets the real name.- Returns:
- the real name
-
setRealName
Sets the real name.- Parameters:
realName- the new real name
-
getComment
Gets the comment.- Returns:
- the comment
-
setComment
Sets the comment.- Parameters:
comment- the new comment
-
getIconBW
Gets the icon bw.- Returns:
- the icon bw
-
setIconBW
Sets the icon bw.- Parameters:
iconBW- the new icon bw
-
getIconColor
Gets the icon color.- Returns:
- the icon color
-
setIconColor
Sets the icon color.- Parameters:
iconColor- the new icon color
-
getFileDatesInfo
Gets the file dates info.- Returns:
- the file dates info
-
setFileDatesInfo
Sets the file dates info.- Parameters:
fileDatesInfo- the new file dates info
-
getFinderInfo
Gets the finder info.- Returns:
- the finder info
-
setFinderInfo
Sets the finder info.- Parameters:
finderInfo- the new finder info
-
getMacintoshInfo
Gets the macintosh info.- Returns:
- the macintosh info
-
setMacintoshInfo
Sets the macintosh info.- Parameters:
macintoshInfo- the new macintosh info
-
getProDOSFileInfo
Gets the pro dos file info.- Returns:
- the pro dos file info
-
setProDOSFileInfo
Sets the pro dos file info.- Parameters:
proDOSFileInfo- the new pro dos file info
-
getMsDOSFileInfo
Gets the ms dos file info.- Returns:
- the ms dos file info
-
setMsDOSFileInfo
Sets the ms dos file info.- Parameters:
msDOSFileInfo- the new ms dos file info
-
getShortName
Gets the short name.- Returns:
- the short name
-
setShortName
Sets the short name.- Parameters:
shortName- the new short name
-
getAfpFileInfo
Gets the afp file info.- Returns:
- the afp file info
-
setAfpFileInfo
Sets the afp file info.- Parameters:
afpFileInfo- the new afp file info
-
getDirectoryID
Gets the directory id.- Returns:
- the directory id
-
setDirectoryID
Sets the directory id.- Parameters:
directoryID- the new directory id
-
getNumEntries
public int getNumEntries()Gets the num entries.- Returns:
- the num entries
-