FSCRT_FILEHANDLER Struct Reference

Structure for file reading or writing (I/O). More...

#include <fs_base_r.h>

Public Attributes

FS_LPVOID clientData
 User-defined data. More...
 
void(* Release )(FS_LPVOID clientData)
 Callback function to release the current file stream object. More...
 
FS_DWORD(* GetSize )(FS_LPVOID clientData)
 Callback function to retrieve the current file stream size. More...
 
FS_RESULT(* ReadBlock )(FS_LPVOID clientData, FS_DWORD offset, FS_LPVOID buffer, FS_DWORD size)
 Callback function to read data from the current file stream. More...
 
FS_RESULT(* WriteBlock )(FS_LPVOID clientData, FS_DWORD offset, FS_LPCVOID buffer, FS_DWORD size)
 Callback function to write data into the current file stream. More...
 
FS_RESULT(* Flush )(FS_LPVOID clientData)
 Callback function to flush all internal accessing buffers. More...
 
FS_RESULT(* Truncate )(FS_LPVOID clientData, FS_DWORD size)
 Callback function to change file size. More...
 

Detailed Description

Structure for file reading or writing (I/O).

Note
This is a handler and should be implemented by callers.
File stream contains basic file accessing methods for not only file reading mode but also file writing mode.
Users can determine whether to implement reading actions or writing actions based on application intentions.
Here, term FSCRT_FILEHANDLER is just a common symbol which represents any stream data I/O and is not limited to file access. For example, access data through internet by HTTP protocol.

Member Data Documentation

FS_LPVOID FSCRT_FILEHANDLER::clientData

User-defined data.

Note
Callers can use this field to track controls.
FS_RESULT(* FSCRT_FILEHANDLER::Flush) (FS_LPVOID clientData)

Callback function to flush all internal accessing buffers.

For reading mode, this function will clear all cached buffers.
For writing mode, this function writes all cached data into file stream.
Sometimes, caller calls this function to make sure data is written into file stream.

Parameters
[in]clientDataPointer to user-defined data.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_FILE if any file accessing error occurs.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
Implementer should avoid any exception when this function is called and ensure proper value is returned.
It is recommended that this function supports multiple-thread environments, this can be decided based on application intention.
FS_DWORD(* FSCRT_FILEHANDLER::GetSize) (FS_LPVOID clientData)

Callback function to retrieve the current file stream size.

Parameters
[in]clientDataPointer to user-defined data.
Returns
32-bit integer size of file stream.
Note
It is recommended that this function supports multiple-thread environments, it can be decided based on application intentions.
FS_RESULT(* FSCRT_FILEHANDLER::ReadBlock) (FS_LPVOID clientData, FS_DWORD offset, FS_LPVOID buffer, FS_DWORD size)

Callback function to read data from the current file stream.

Parameters
[in]clientDataPointer to user-defined data.
[in]offsetOffset position starts from the beginning of file stream. This parameter indicates reading position.
[in]bufferMemory buffer to store data which are read from file stream. This parameter should not be NULL.
[in]sizeSize of data which should be read from file stream, in bytes. The buffer indicated by the parameter buffer should be enough to store specified data.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter buffer is NULL.
FSCRT_ERRCODE_FILE if the parameter offset exceeds current file size or cannot read the amount of data specified by parameter size or any file accessing error occurs.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
This function provides random file stream reading support and is called by Foxit PDF SDK internally.
Implementer should avoid any exception when this function is called and ensure proper value returned.
It is recommended that this function supports multiple-thread environments, this can be decided based on application intention.
void(* FSCRT_FILEHANDLER::Release) (FS_LPVOID clientData)

Callback function to release the current file stream object.

Parameters
[in]clientDataPointer to user-defined data.
Returns
None.
Note
Function FSCRT_File_Release calls this function to release stream object.
It is recommended that this function supports multiple-thread environments, it can be decided based on application intentions.
FS_RESULT(* FSCRT_FILEHANDLER::Truncate) (FS_LPVOID clientData, FS_DWORD size)

Callback function to change file size.

This function is called under writing mode usually. Implementer can determine whether to realize it based on application requests.

Parameters
[in]clientDataPointer to user-defined data.
[in]sizeNew size of file stream, in bytes.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_FILE if any file accessing error occurs.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
Implementer should avoid any exception when this function is called and ensure proper value is returned.
It is recommended that this function supports multiple-thread environments, this can be decided based on application intention.
FS_RESULT(* FSCRT_FILEHANDLER::WriteBlock) (FS_LPVOID clientData, FS_DWORD offset, FS_LPCVOID buffer, FS_DWORD size)

Callback function to write data into the current file stream.

Parameters
[in]clientDataPointer to user-defined data.
[in]offsetOffset position starts from the beginning of file stream. This parameter indicates writing position.
[in]bufferMemory buffer contains data which is written into file stream. This parameter should not be NULL.
[in]sizeSize of data which should be written into file stream, in bytes.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if parameter buffer is a NULL pointer.
FSCRT_ERRCODE_FILE if any file accessing error occurs.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
This function provides random file stream writing support and is called by Foxit PDF SDK internally.
Implementer should avoid any exception when this function is called and ensure proper value returned.
It is recommended that this function supports multiple-thread environments, this can be decided based on application intention.

The documentation for this struct was generated from the following file:

Foxit Corporation