My Project
|
Cached file read interface. More...
Public Member Functions | |
FX_BOOL | AttachFile (IFX_FileRead *pFile, FX_BOOL bTakeOver) |
Attach a file read. More... | |
virtual FX_INT64 | GetPosition () |
Get the current reading position in stream. More... | |
virtual FX_INT64 | GetSize () |
Get total size of the file. More... | |
FX_BOOL | Init (FX_INT32 nChunkSize, FX_INT32 nChunkCount, FX_LPVOID pBuffer, IFX_Allocator *pAllocator=0) |
Initialize the chunk size and chunk count. More... | |
virtual FX_BOOL | IsEOF () |
Determine whether reach the end of stream. More... | |
FX_BOOL | PreCache (FX_INT64 offset, FX_INT32 nCacheCount) |
Attach a file read. More... | |
virtual FX_BOOL | ReadBlock (void *buffer, FX_INT64 offset, size_t size) |
Read a data block from the file. More... | |
virtual size_t | ReadBlock (void *buffer, size_t size) |
Read data block from stream. More... | |
![]() | |
virtual FX_BOOL | WriteBlock (const void *buffer, size_t size) |
Write a block data to the end of current stream. More... | |
![]() | |
virtual void | ClearRange () |
Clear accessing range set by function IFX_FileRead::SetRange. More... | |
virtual FX_BOOL | SetRange (FX_INT64 offset, FX_INT64 size) |
Set accessing range. More... | |
Protected Member Functions | |
virtual FX_BOOL | Flush () |
Flush internal buffer. Unsupported for reading mode, return false directly. | |
virtual void | Release () |
Destroy the current instance. More... | |
virtual IFX_FileStream * | Retain () |
Create a shared instance. More... | |
virtual FX_BOOL | WriteBlock (const void *buffer, FX_INT64 offset, size_t size) |
Write a block data into stream. Unsupported for reading mode, return false directly. | |
Cached file read interface.
FX_BOOL CFX_CachedFileRead::AttachFile | ( | IFX_FileRead * | pFile, |
FX_BOOL | bTakeOver | ||
) |
Attach a file read.
[in] | pFile | The file to be attached. |
[in] | bTakeOver | Take over the file or not. |
|
virtual |
Get the current reading position in stream.
Implements IFX_FileStream.
|
virtual |
Get total size of the file.
Implements IFX_FileStream.
FX_BOOL CFX_CachedFileRead::Init | ( | FX_INT32 | nChunkSize, |
FX_INT32 | nChunkCount, | ||
FX_LPVOID | pBuffer, | ||
IFX_Allocator * | pAllocator = 0 |
||
) |
Initialize the chunk size and chunk count.
[in] | nChunkSize | The size of each chunk. |
[in] | nChunkCount | The total count of chunks. |
[in] | pBuffer | External buffer. NULL means cache is disabled. |
[in] | pAllocator | Allocator used in this class. NULL means to use default allocator. Default value: NULL. |
|
virtual |
Determine whether reach the end of stream.
Implements IFX_FileStream.
Attach a file read.
[in] | offset | The file to be attached. |
[in] | nCacheCount | Take over the file or not. |
|
virtual |
Read a data block from the file.
[in,out] | buffer | Pointer to a buffer receiving read data |
[in] | offset | Byte offset from beginning of the file |
[in] | size | Number of bytes for the block. |
Implements IFX_FileStream.
|
virtual |
Read data block from stream.
[in,out] | buffer | Buffer to store data. |
[in] | size | Total size of buffer, in bytes. |
Implements IFX_FileStream.
|
protectedvirtual |
|
protectedvirtual |