com.foxit.sdk.common.fxcrt.FileStreamCallback Class Reference

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

Public Member Functions

boolean flush ()
 Flush internal buffer.
More...
 
int getPosition ()
 Get the current reading position in stream.
More...
 
int getSize ()
 Get the current stream size, in bytes.
More...
 
boolean isEOF ()
 Determine whether reach the end of stream.
More...
 
boolean readBlock (byte[] buffer, int 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...
 
FileStreamCallback retain ()
 Create a shared instance.
More...
 
boolean writeBlock (byte[] buffer, int 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.FileStreamCallback.flush ( )

Flush internal buffer.

Returns
true means success, and false means failure.

◆ getPosition()

int com.foxit.sdk.common.fxcrt.FileStreamCallback.getPosition ( )

Get the current reading position in stream.

Returns
Current reading position.

◆ getSize()

int com.foxit.sdk.common.fxcrt.FileStreamCallback.getSize ( )

Get the current stream size, in bytes.

Returns
Current stream size, in bytes.

◆ isEOF()

boolean com.foxit.sdk.common.fxcrt.FileStreamCallback.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.FileStreamCallback.readBlock ( byte []  buffer,
int  offset,
long  size 
)

Read a data block from stream.

Parameters
[in,out]bufferPointer to a buffer receiving data.
[in]offsetByte offset from beginning of the file, the position to read data.
[in]sizeNumber of bytes to be read from stream.
Returns
true means success, and false means failure.

◆ readBlock() [2/2]

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

Read data block from stream.

Parameters
[in,out]bufferBuffer to store data.
[in]sizeTotal 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.FileStreamCallback.release ( )

Destroy the current instance.

Returns
None.

◆ retain()

FileStreamCallback com.foxit.sdk.common.fxcrt.FileStreamCallback.retain ( )

Create a shared instance.

Returns
File stream interface.

◆ writeBlock()

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

Write a block data into stream.

Parameters
[in]bufferPointer to the data block.
[in]offsetByte offset from beginning of the file, the position to write data.
[in]sizeThe length in bytes of the buffer.
Returns
true means success, and false means failure.