Foxit PDF SDK
foxit::common::file::AsyncReaderCallback Class Referenceabstract
Inheritance diagram for foxit::common::file::AsyncReaderCallback:
IFX_FileRead IFX_StreamRead

Public Member Functions

virtual bool AddDownloadHint (int64 offset, size_t size)=0
 A callback function used to add offset and size to specify a data section, which should be downloaded by application then. More...
 
virtual bool IsDataAvail (int64 offset, size_t size)=0
 A callback function used to check whether the specified data section is available or not. More...
 
- Public Member Functions inherited from IFX_FileRead
virtual void ClearRange ()
 Clear accessing range set by function IFX_FileRead::SetRange. More...
 
virtual FX_INT64 GetPosition ()
 Get the current reading position in stream. More...
 
virtual FX_INT64 GetSize ()=0
 Get total size of the file. More...
 
virtual FX_BOOL IsEOF ()
 Determine whether reach the end of stream. More...
 
virtual FX_BOOL ReadBlock (void *buffer, FX_INT64 offset, size_t size)=0
 Read a data block from the file. More...
 
virtual size_t ReadBlock (void *buffer, size_t size)
 Read data block from stream. More...
 
virtual void Release ()=0
 Called when to release everything. More...
 
virtual FX_INT64 SetPosition (FX_INT64 pos)
 Set the current file accessing position. More...
 
virtual FX_BOOL SetRange (FX_INT64 offset, FX_INT64 size)
 Set accessing range. More...
 

Detailed Description

This class represents a callback object to do file reading asynchronously. This class is derived from class ReaderCallback. All the pure virtual functions in this class and its base class are used as callback functions and should be implemented by user, in order to asynchronously read file data (especially used for loading document), in a customized way.

See also
ReaderCallback

Member Function Documentation

◆ AddDownloadHint()

virtual bool foxit::common::file::AsyncReaderCallback::AddDownloadHint ( int64  offset,
size_t  size 
)
pure virtual

A callback function used to add offset and size to specify a data section, which should be downloaded by application then.

Foxit PDF SDK would call this callback function to report downloading hints for the download manager of application.
The position (as offset) and size of the section may not be accurate because part of the section might already be available. The download manager must manage this to maximize download efficiency.

Parameters
[in]offsetThe offset of a data section, which is to be hinted.
[in]sizeThe size of the data section.
Returns
true means success, while false means failure.

◆ IsDataAvail()

virtual bool foxit::common::file::AsyncReaderCallback::IsDataAvail ( int64  offset,
size_t  size 
)
pure virtual

A callback function used to check whether the specified data section is available or not.

A data section is available only if all bytes in the section are available.

Parameters
[in]offsetThe offset in file.
[in]sizeThe size of the data section, which is to be checked if available.
Returns
true means the specified data section is available, while false means the specified data section is not available yet.