eof |
( BOOL ) eof;
Returns YES when bytes were read up to or past the end of file, or when the file cursor is moved past the last byte.
fileInfo |
( NSDictionary *) fileInfo;
File information dictionaries from MPQFile objects will
always contain the following keys:
MPQFileLength: The size of the file in bytes as an integer.
MPQFileCompressedLength: The compressed size of the file in bytes as an integer.
MPQFileFlags: The file's flags as an integer. See the MPQFileFlag enum in
MPQSharedConstants.h for a list of valid bit values.
MPQFileLocale: The file's locale code as an integer. See the MPQLocale enum in
MPQSharedConstants.h for a list of valid values.
MPQFileHashA: The file's A hash as an integer. Mostly useless.
MPQFileHashB: The file's B hash as an integer. Mostly useless as well.
MPQFileHashPosition: The file's hash table position. Can be used as a unique key for that
particular file (in fact, a file's path is not a unique key, so this is the only unique key
for MPQ files).
File information dictionaries may also contain the following key:
MPQFileName: The file's path inside the MPQ archive. Note that the path separator is \.
Additionally, file information dictionaries may contain one or more MPQ file attribute keys.
Please refer to the documentation of the header MPQSharedConstants.h for a list of valid keys.
initForFile |
( id ) initForFile:
(NSDictionary *) mpqFileInfoDict;
Never initialize MPQFile objects yourself. Use methods in MPQArchive to create MPQFile objects instead.
initForFile: |
( id ) initForFile:
(NSDictionary *) mpqFileInfoDict;
Never initialize MPQFile objects yourself. Use methods in MPQArchive to create MPQFile objects instead.
- mpqFileInfoDict
- Information dictionary containing data to initialize the MPQFile object.
length |
( int ) length;
If you are going to use atomical writing, you'll need twice that amount of space on the target disk to extract the file.
name |
( NSString *) name;
Note that the path separator is \.
offsetInFile |
( int ) offsetInFile;
This should always return 0 for newly created MPQFile instances.
readDataOfLength |
( NSData *) readDataOfLength:
(unsigned int ) dwNumberOfBytesToRead;
IMPORTANT: The size of the returned data may actually be smaller than the number of
requested bytes, if the number of requested bytes would cause the file pointer
to go beyond the end of file.
The file pointer is incremented by the number of bytes returned.
readDataOfLength: |
( NSData *) readDataOfLength:
(unsigned int ) dwNumberOfBytesToRead;
IMPORTANT: The size of the returned data may actually be smaller than the number of
requested bytes, if the number of requested bytes would cause the file pointer
to go beyond the end of file.
The file pointer is incremented by the number of bytes returned.
- dwNumberOfBytesToRead
- The number of bytes to read.
readDataToEndOfFile |
( NSData *) readDataToEndOfFile;
IMPORTANT: The size of the returned data may actually be smaller than the number of
requested bytes, if the number of requested bytes would cause the file pointer
to go beyond the end of file.
The file pointer is incremented by the number of bytes returned.
Note that this method simply calls the readDataOfLength: method with the number
of bytes to read set to whatever value will move the file pointer to the end of file.
seekToFileOffset |
( void ) seekToFileOffset:
(unsigned long ) nDistanceToMove;
Note that this method simply calls seekToFileOffset:withMode: with the MPQFileBegin mode.
seekToFileOffset |
( void ) seekToFileOffset:
(unsigned long ) nDistanceToMove withMode :
(MPQFileDisplacementMode ) dwMoveMethod;
The valid displacement modes are:
MPQFileStart: Seeking is done with respect to the beginning of the file
and toward the end of file. In effect, this makes nDistanceToMove an absolute
file offset to seek to.
MPQFileCurrent: Seeking is done with respect to the current file pointer
and toward the end of file. If nDistanceToMove will move the file pointer
beyond the end of file, the file pointer is moved to the end of file.
MPQFileEnd: Seeking is done with respect to the end of file and toward
the beginning of the file. If nDistanceToMove will move the file pointer
to a negative position, the file pointer is moved to the beginning of the
file.
seekToFileOffset: |
( void ) seekToFileOffset:
(unsigned long ) nDistanceToMove;
Note that this method simply calls seekToFileOffset:withMode: with the MPQFileBegin mode.
- nDistanceToMove
- The number of bytes to move from the beginning of the file as an unsigned integer.
seekToFileOffset:withMode: |
( void ) seekToFileOffset:
(unsigned long ) nDistanceToMove withMode :
(MPQFileDisplacementMode ) dwMoveMethod;
The valid displacement modes are:
MPQFileStart: Seeking is done with respect to the beginning of the file
and toward the end of file. In effect, this makes nDistanceToMove an absolute
file offset to seek to.
MPQFileCurrent: Seeking is done with respect to the current file pointer
and toward the end of file. If nDistanceToMove will move the file pointer
beyond the end of file, the file pointer is moved to the end of file.
MPQFileEnd: Seeking is done with respect to the end of file and toward
the beginning of the file. If nDistanceToMove will move the file pointer
to a negative position, the file pointer is moved to the beginning of the
file.
- nDistanceToMove
- The number of bytes to move from the beginning of the file as an unsigned integer.
- dwMoveMethod
- The displacement method. Must be a valid MPQFileDisplacementMode constant. Will affect the interpretation of nDistanceToMove.
writeToFile |
( BOOL ) writeToFile:
(NSString *) path atomically :
(BOOL ) flag;
Note that this method simply calls the readDataOfLength: method with the number
of bytes to read set to whatever value will move the file pointer to the end of file.
Note that this method simply calls NSData's writeToFile:atomically: method to write
the data to the disk.
writeToFile:atomically: |
( BOOL ) writeToFile:
(NSString *) path atomically :
(BOOL ) flag;
Note that this method simply calls the readDataOfLength: method with the number
of bytes to read set to whatever value will move the file pointer to the end of file.
Note that this method simply calls NSData's writeToFile:atomically: method to write
the data to the disk.
(Last Updated 5/8/2004)