Foxit PDF SDK
IFX_FileRead Class Referenceabstract

File reading interface. More...

Inheritance diagram for IFX_FileRead:
IFX_StreamRead foxit::common::file::AsyncReaderCallback IFX_FileStream CFX_CachedFileRead IFX_MemoryStream

Public Member Functions

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_BOOL SetRange (FX_INT64 offset, FX_INT64 size)
 Set accessing range. More...
 

Detailed Description

File reading interface.

Member Function Documentation

◆ ClearRange()

virtual void IFX_FileRead::ClearRange ( )
inlinevirtual

Clear accessing range set by function IFX_FileRead::SetRange.

Returns
None.

◆ GetPosition()

virtual FX_INT64 IFX_FileRead::GetPosition ( )
inlinevirtual

Get the current reading position in stream.

Returns
The current reading position in stream.

Implements IFX_StreamRead.

Reimplemented in CFX_CachedFileRead, and IFX_FileStream.

◆ GetSize()

virtual FX_INT64 IFX_FileRead::GetSize ( )
pure virtual

Get total size of the file.

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

Implemented in CFX_CachedFileRead, and IFX_FileStream.

◆ IsEOF()

virtual FX_BOOL IFX_FileRead::IsEOF ( )
inlinevirtual

Determine whether reach the end of stream.

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

Implements IFX_StreamRead.

Reimplemented in CFX_CachedFileRead, and IFX_FileStream.

◆ ReadBlock() [1/2]

virtual FX_BOOL IFX_FileRead::ReadBlock ( void *  buffer,
FX_INT64  offset,
size_t  size 
)
pure virtual

Read a data block from the file.

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

Implemented in CFX_CachedFileRead, and IFX_FileStream.

◆ ReadBlock() [2/2]

virtual size_t IFX_FileRead::ReadBlock ( void *  buffer,
size_t  size 
)
inlinevirtual

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, that means error or no data.

Implements IFX_StreamRead.

Reimplemented in CFX_CachedFileRead, and IFX_FileStream.

◆ Release()

virtual void IFX_FileRead::Release ( )
pure virtual

Called when to release everything.

Returns
None.

Implements IFX_StreamRead.

Implemented in CFX_CachedFileRead, and IFX_FileStream.

◆ SetRange()

virtual FX_BOOL IFX_FileRead::SetRange ( FX_INT64  offset,
FX_INT64  size 
)
inlinevirtual

Set accessing range.

Parameters
[in]offset
[in]size
Returns
true means success, and false means failure.