Foxit PDF SDK

Public Member Functions | List of all members
com.foxit.sdk.common.fxcrt.StreamCallback Class Reference

File stream interface, reading & writing.
More...

## Public Member Functions
boolean | flush ()
| Flush internal buffer. More...
long | getPosition ()
| Get the current reading position in stream. More...
long | getSize ()
| Get the current stream size, in bytes. More...
boolean | isEOF ()
| Determine whether reach the end of stream. More...
boolean | readBlock (byte[] buffer, long offset, long size)
| Read a data block from stream. More...
long | readBlock (byte[] buffer, long size)
| Read data block from stream. More...
void | release ()
| Destroy the current instance. More...
StreamCallback | retain ()
| Create a shared instance. More...
boolean | writeBlock (byte[] buffer, long offset, long size)
| Write a block data into stream. More...

## Detailed Description

File stream interface, reading & writing.

## Member Function Documentation

## ◆ flush()

boolean com.foxit.sdk.common.fxcrt.StreamCallback.flush | ( |  | ) |

Flush internal buffer.

Returns
  true means success, and false means failure.

## ◆ getPosition()

long com.foxit.sdk.common.fxcrt.StreamCallback.getPosition | ( |  | ) |

Get the current reading position in stream.

Returns
  Current reading position.

## ◆ getSize()

long com.foxit.sdk.common.fxcrt.StreamCallback.getSize | ( |  | ) |

Get the current stream size, in bytes.

Returns
  Current stream size, in bytes.

## ◆ isEOF()

boolean com.foxit.sdk.common.fxcrt.StreamCallback.isEOF | ( |  | ) |

Determine whether reach the end of stream.

Returns
  true means reach the end of stream, and false means not yet.

## ◆ readBlock() [1/2]

boolean com.foxit.sdk.common.fxcrt.StreamCallback.readBlock | ( | byte[] | buffer,
|  | long | offset,
|  | long | size
| ) |  |

Read a data block from stream.

Parameters

  [in,out] | buffer | Pointer to a buffer receiving data.
  [in] | offset | Byte offset from beginning of the file, the position to read data.
  [in] | size | Number of bytes to be read from stream.

Returns
  true means success, and false means failure.

## ◆ readBlock() [2/2]

long com.foxit.sdk.common.fxcrt.StreamCallback.readBlock | ( | byte[] | buffer,
|  | long | size
| ) |  |

Read data block from stream.

Parameters

  [in,out] | buffer | Buffer to store data.
  [in] | size | Total size of buffer, in bytes.

Returns
  The length of data stored in buffer. If returns 0, means error or no data.

## ◆ release()

void com.foxit.sdk.common.fxcrt.StreamCallback.release | ( |  | ) |

Destroy the current instance.

Returns
  None.

## ◆ retain()

StreamCallback com.foxit.sdk.common.fxcrt.StreamCallback.retain | ( |  | ) |

Create a shared instance.

Returns
  File stream interface.

## ◆ writeBlock()

boolean com.foxit.sdk.common.fxcrt.StreamCallback.writeBlock | ( | byte[] | buffer,
|  | long | offset,
|  | long | size
| ) |  |

Write a block data into stream.

Parameters

  [in] | buffer | Pointer to the data block.
  [in] | offset | Byte offset from beginning of the file, the position to write data.
  [in] | size | The length in bytes of the buffer.

Returns
  true means success, and false means failure.