Foxit PDF RDK

Public Member Functions | List of all members
AsyncReaderCallback Class Reference

## Public Member Functions
| AddDownloadHint (offset, size)
| A callback function used to add offset and size to specify a data section, which should be downloaded by application then. More...
| GetSize ()
| Get total size of the file. More...
| IsDataAvail (offset, size)
| A callback function used to check whether the specified data section is available or not. More...
| ReadBlock (offset, size)
| Read a data block from the file. More...

## Detailed Description

This class represents a callback object to do file reading asynchronously. This class is derived from class FileReaderCallback. 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
  FileReaderCallback

## Member Function Documentation

## ◆ AddDownloadHint()

AsyncReaderCallback.AddDownloadHint | ( | offset | ,
|  | size |
| ) |  |

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] | offset | The offset of a data section, which is to be hinted.
  [in] | size | The size of the data section.

Returns
  true means success, while false means failure.

## ◆ GetSize()

AsyncReaderCallback.GetSize | ( |  | ) |

Get total size of the file.

Returns
  File size, in bytes. Implementation can return 0 for any error.

## ◆ IsDataAvail()

AsyncReaderCallback.IsDataAvail | ( | offset | ,
|  | size |
| ) |  |

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] | offset | The offset in file.
  [in] | size | The 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.

## ◆ ReadBlock()

AsyncReaderCallback.ReadBlock | ( | offset | ,
|  | size |
| ) |  |

Read a data block from the file.

Parameters

  [in] | offset | Byte offset from beginning of the file
  [in] | size | Number of bytes for the block.

Returns
  A buffer receiving read data.