#define ASFILE_CREATE 4
#define ASFILE_ENCRYPT 128
#define ASFILE_LOCAL 16
#define ASFILE_RANDOMACCESS 32
#define ASFILE_READ 1
#define ASFILE_SERIAL 8
#define ASFILE_TEMPORARY 64
#define ASFILE_WRITE 2
#define MDFile ASMDFile
true. #define kASFileDialUp 0x00000010L
#define kASFileDoCaching 0x00000008L
true if the file has outstanding MReads. #define kASFileHasOutstandingMReads 0x00000040L
true if the file is built with a Virtual EOF (Acrobat 10). #define kASFileHasVirtualEOF 0x00000080L
#define kASFileModeDisableExplicitMReadRequests 0x0002
#define kASFileModeDoNotYieldIfBytesNotReady 0x0001
#define kASFileNoRequestIfBytesNotReady 0x0008
#define kASFileRaiseIfBytesNotReady 0x0004
#define kASFileSlowConnect 0x00000002L
#define kASFileSlowTransfer 0x00000001L
#define kASFileStillFetching 0x00000020L
ASFileRead will suspend the current thread when trying to read from a file with a cache for which the requested bytes are not yet present. Note that if kASFileSuspendIfBytesNotReady is set, the kASFileRaiseIfBytesNotReady is ignored. #define kASFileSuspendIfBytesNotReady 0x0010
#define kASFileUseMRead 0x00000004L
kASFileOkay=0x0000 | The MDFile is in a valid state.
|
kASFileIsTerminating=0x0001 | The MDFile is being closed (for example, because the file is being displayed in a web browser's window and the user cancelled downloading).
|
typedef void *ASFile;
typedef ASInt32 ASFileOffset;
typedef ASInt64 ASFileOffset64;
typedef ASUns32 ASFilePos;
typedef ASUns64 ASFilePos64;
ASMDFile replaces MDFile. MDFile is an obsolete name for this data type for backward compatibility.
An MDFile is an opaque representation of a file instance for a particular file system. File system implementors may choose any convenient representation for an MDFile. In particular, file systems need not worry about MDFile space conflicts; the ASFile object exported by the common implementation is guaranteed to be unique across all open files, and the common implementation maps calls of ASFile methods to calls of ASFileSystem callbacks with the corresponding MDFile.
typedef void *ASMDFile;
typedef ASInt32 ASTFilePos;
typedef ASUns32 ASTFilePos;
void ASFileCompletionProc(ASFile aFile, const char *p, ASTFilePos fileOffsetRequested, ASTArraySize countRequested, ASTArraySize nBytesRead, ASErrorCode error, void *compProcClientData);
aFile | IN/OUT The ASFile for which data is read or written.
|
p | IN/OUT A pointer to the buffer provided by the client. It contains
nBytesRead bytes of data if error is zero. |
fileOffsetRequested | IN/OUT The file offset requested by the client.
|
countRequested | IN/OUT The number of bytes requested by the client.
|
nBytesRead | IN/OUT The number of bytes actually read or written.
|
error | IN/OUT The error condition if it is non-zero; see AcroErr.h.
|
compProcClientData | IN/OUT The client data parameter provided by client.
|
ASPathName ASFileAcquirePathName(ASFile aFile);
aFile | IN/OUT The file whose path name is acquired.
|
asFile. You can use ASFileSysDIPathFromPath() to convert this to a device-independent path name. ASBool ASFileCanSetEOF(ASFile file, ASInt32 newFileSize);
file | The file in question.
|
newFileSize | The proposed new file size. This parameter will be treated as unsigned.
|
mreads for the given file. void ASFileClearOutstandingMReads(ASFile fN);
fN | The file to clear
mreads for. |
ASErrorCode ASFileClose(ASFile aFile);
aFile | IN/OUT The file to close. The file must have been opened previously using ASFileSysOpenFile().
|
0 if the operation was successful; some file system or platform-dependent error code is returned otherwise. void ASFileFlush(ASFile aFile);
aFile | The file whose data is flushed.
|
ASBool ASFileFromMDFile(ASMDFile mdFile, ASFileSys fileSys, ASFile *pfN);
mdFile | IN/OUT The ASMDFile for which the information is desired.
|
fileSys | IN/OUT The ASFileSys through which
fileID was opened. |
pfN |
ASTFilePos ASFileGetEOF(ASFile aFile);
aFile | The ASFile whose size is obtained.
|
ASFilePos64 ASFileGetEOF64(ASFile aFile);
aFile | IN/OUT The ASFile whose size is obtained. This call will work with files over 2 GB in length.
|
ASFileSys ASFileGetFileSys(ASFile aFile);
aFile | IN/OUT The open file whose file system is obtained.
|
ASFileSys ASFileGetFileSysByName(ASAtom name);
name | IN/OUT The ASAtom corresponding to the name of the file system to obtain. It may be one of the following:
|
NULL if no matching file system was found. ASBool ASFileGetMDFile(ASFile fN, ASMDFile *pFileID, ASFileSys *pFileSys);
fN | IN/OUT The ASFile for which the information is desired.
|
pFileID | |
pFileSys | IN/OUT (Filled by the method, may be
NULL) The file system through which this file was opened. |
ASFileMode ASFileGetOpenMode(ASFile fN);
fN | The file in question.
|
A value corresponding to one or more ASFileMode objects used to access or create the file, as shown in the table below. The values that can be returned include combinations of the following, OR'd with each other:
Return value from ASFileGetOpenMode():
Return value | Meaning
|
|---|---|
0 | created
|
1 | readable
|
2 | readable and writable
|
8 | sequential access
|
16 | local
|
ASTFilePos ASFileGetPos(ASFile aFile);
aFile | IN/OUT The file in which to get the seek position.
|
ASFilePos64 ASFileGetPos64(ASFile aFile);
aFile | IN/OUT The file in which to get the seek position.
|
char *ASFileGetURL(ASFile asf);
asf | IN/OUT The file in question.
|
NULL if it could not be determined. On all file systems, the path will be URL-escaped. On the default file system, encoding will be platform-encoded. On Unicode and browser file systems, encoding will be UTF8. ASErrorCode ASFileHardFlush(ASFile aFile);
aFile | The file that is flushed.
|
0 if the operation succeeded,-1 if there was an error. mreads if it was opened in a browser, Acrobat requested some byte ranges, and the byte ranges have not yet arrived. ASBool ASFileHasOutstandingMReads(ASFile fN);
fN | The file in question.
|
false if the file was not opened through the fileSys file system. Note: This method is not guaranteed to work on all file systems.
ASBool ASFileIsSame(ASFile fN, ASPathName pathName, ASFileSys fileSys);
fN | IN/OUT The file in question.
|
pathName | IN/OUT The ASPathName in question.
|
fileSys | IN/OUT The file system from which the path was obtained.
|
void ASFileMReadRequest(ASFile fN, ASInt32 *blockPairs, ASTCount nBlockPairs);
fN | The file for which you wish to make read requests.
|
blockPairs | |
nBlockPairs | The number of block pairs to request.
|
ASInt32 ASFileOpenWithVirtualEOF(ASFile fN, ASFilePos64 virtualEOF, ASFile *newFile);
fN | |
virtualEOF | IN The new EOF.
|
newFile |
Sends data from a file system implementation to an ASFile. The data may be for a multi-read request call, or may be unsolicited.
This method can only be called from within a file system implementation. It must not be called by clients of the ASFile, such as a caller that acquired the file with ASFileSysOpenFile().
void ASFilePushData(ASFile aFile, const char *p, ASTFilePos offset, ASTArraySize length);
aFile | IN/OUT The file to which data is sent.
|
p | IN/OUT The data being pushed.
|
offset | IN/OUT A byte offset into the file at which the data should be written.
|
length | IN/OUT The number of bytes held in the buffer.
|
ASTArraySize ASFileRead(ASFile aFile, char *p, ASTArraySize count);
aFile | IN/OUT The file from which data is read.
|
p | IN/OUT (Filled by the method) A buffer into which data is written. The buffer must be able to hold at least
count bytes. |
count | IN/OUT The number of bytes to read.
|
fileSys provides its name via the ASFileSysGetFileSysNameProc() callback. This method returns false if a file system with the same name is already registered. ASBool ASFileRegisterFileSys(ASExtension extension, ASFileSys fileSys);
extension | IN/OUT The gExtensionID of the plug-in registering the
fileSys. |
fileSys | IN/OUT The ASFileSys being registered.
|
Note: The file mode and return types changed in 0x00060000.
ASErrorCode ASFileReopen(ASFile aFile, ASFileMode mode);
aFile | The file to reopen.
|
mode | An open-mode value as specified for ASFileMode.
|
0 if the operation was successful; some file system or platform-dependent error code is returned otherwise. void ASFileSetEOF(ASFile aFile, ASTFilePos newFileSize);
aFile | The file whose size is changed.
|
newFileSize | The new size of file.
|
asGenErrMethodNotImplemented
| |
asFileErrGeneral
|
void ASFileSetEOF64(ASFile aFile, ASFilePos64 newFileSize);
aFile | IN/OUT The file whose size is changed.
|
newFileSize | IN/OUT The new size of the file.
|
0 for modeValue and modeMask to simply get the current mode flags. Note: This operation is primarily intended for slow file systems such as the Internet, where there can potentially be an appreciable wait between requesting and retrieving bytes.
ASFlagBits ASFileSetMode(ASFile fN, ASFlagBits modeValue, ASFlagBits modeMask);
fN | The file for which to get or set the mode.
|
modeValue | The mode flag values to get or set, which are described in ASFileMode Flags.
|
modeMask | The mask for the mode flags to get or set.
|
0 if the file system does not support this operation. void ASFileSetPos(ASFile aFile, ASTFilePos pos);
aFile | IN/OUT The file in which to seek.
|
pos | IN/OUT The position to seek.
|
void ASFileSetPos64(ASFile aFile, ASFilePos64 pos);
aFile | IN/OUT The file in which to seek.
|
pos | IN/OUT The position to seek.
|
ASStm ASFileStmRdOpen(ASFile afile, ASSmallBufferSize bufSize);
afile | The open file to associate with the stream. The file must have been opened previously using ASFileSysOpenFile(). Each open file has a unique ASFile. The ASFile value has meaning only to the common ASFile implementation and bears no relationship to platform-specific file objects.
|
bufSize | The length in bytes of the data buffer. If
bufSize is 0, the default buffer size (currently 4 K) will be used. The default is generally sufficient. A larger buffer size should be used only when data in the file will be accessed in chunks larger than the default buffer. Although bufSize is passed as an ASUns16, it is treated internally as an ASInt16. As a result, buffer sizes above 32 K are not permitted. |
ASStm ASFileStmWrOpen(ASFile afile, ASSmallBufferSize bufSize);
afile | The open file to associate with the stream. The file must have been opened previously using ASFileSysOpenFile(). Each open file has a unique ASFile. The ASFile value has meaning only to the common ASFile implementation and bears no relationship to platform-specific file objects.
|
bufSize | The length in bytes of a data buffer. If
bufSize is 0, the default buffer size (currently 4kB) is used. The default is generally sufficient. A larger buffer size should be used only when data in the file will be accessed in chunks larger than the default buffer. Although bufSize is passed as an ASUns16, it is treated internally as an ASInt16. As a result, buffer sizes above 32 K are not permitted. |
fileSys to be unregistered. In general, a fileSys is only unregistered by the extension that registered it. ASBool ASFileUnregisterFileSys(ASExtension extension, ASFileSys fileSys);
extension | IN/OUT The gExtensionID of the plug-in un-registering
fileSys. |
fileSys | IN/OUT The ASFileSys to un-register.
|
ASTArraySize ASFileWrite(ASFile aFile, const char *p, ASTArraySize count);
aFile | IN/OUT The file to which data is written.
|
p | IN/OUT A buffer holding the data that is to be written. The buffer must be able to hold at least
count bytes. |
count | IN/OUT The number of bytes to write.
|