fx_stream.h
Go to the documentation of this file.
1 
15 //<<<+++OPENSOURCE
16 //<<<+++OPENSOURCE_LICENSE
17 //<<<+++OPENSOURCE_BEGIN LIC==FOXIT||LIC==GOOGLE
18 
24 //<<<+++OPENSOURCE_MUST_BEGIN
25 #ifndef _FX_STREAM_H_
26 #define _FX_STREAM_H_
27 
28 #ifndef _FX_MEMORY_H_
29  #include "fx_memory.h"
30 #endif
31 //<<<+++OPENSOURCE_MUST_END
32 
33 //*****************************************************************************
34 //* Folder access
35 //*****************************************************************************
36 #if !defined(_FPDFAPI_MINI_) || (defined(_WIN32) && !defined(_FX_NO_WINDOWS_)) || _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ || _FX_OS_ == _FX_ANDROID_ || _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
37 
44 void* FX_OpenFolder(FX_LPCSTR path);
52 void* FX_OpenFolder(FX_LPCWSTR path);
53 
64 FX_BOOL FX_GetNextFile(void* handle, CFX_ByteString& filename, FX_BOOL& bFolder, FX_LPCSTR absPath=NULL);
75 FX_BOOL FX_GetNextFile(void* handle, CFX_WideString& filename, FX_BOOL& bFolder, FX_LPCSTR absPath=NULL);
76 
84 void FX_CloseFolder(void* handle);
85 
92 
93 #endif
94 
95 #if _FX_OS_ != _FX_EMBEDDED_
96 //<<<+++OPENSOURCE_BEGIN LIC==FOXIT
113 
122 //<<<+++OPENSOURCE_END
123 #endif
124 
125 //*****************************************************************************
126 //* File access
127 //*****************************************************************************
130 
131  //<<<+++OPENSOURCE_MUST_BEGIN LIC==FOXIT
132  #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || _FX_OS_ == _FX_WIN64_
133  #if defined(_FX_LARGEFILE_SUPPORT_)
134 
135  #define _FX_LARGEFILE_USED_
136 
138  #define FX_FILESIZE FX_INT64
139  #define FX_GETBYTEOFFSET32(a) ((FX_BYTE)((a>>16)>>16))
140  #define FX_GETBYTEOFFSET40(a) ((FX_BYTE)(((a>>16)>>16)>>8))
141  #define FX_GETBYTEOFFSET48(a) ((FX_BYTE)(((a>>16)>>16)>>16))
142  #define FX_GETBYTEOFFSET56(a) ((FX_BYTE)((((a>>16)>>16)>>16)>>8))
143  #else
144 
145  #define FX_FILESIZE FX_INT32
146  #define FX_GETBYTEOFFSET32(a) 0
147  #define FX_GETBYTEOFFSET40(a) 0
148  #define FX_GETBYTEOFFSET48(a) 0
149  #define FX_GETBYTEOFFSET56(a) 0
150  #endif
151  #elif _FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_MACOSX_ || _FX_OS_ == _FX_IOS_ || _FX_OS_ == _FX_ANDROID_
152  #if defined(_FX_LARGEFILE_SUPPORT_)
153 
154  #define _FX_LARGEFILE_USED_
155 
156  #ifndef _LARGEFILE_SOURCE
157  #define _LARGEFILE_SOURCE
158  #endif
159  #ifndef _LARGEFILE64_SOURCE
160  #define _LARGEFILE64_SOURCE
161  #endif
162  #endif
163  #if defined(_FX_LARGEFILE_SUPPORT_)
164  #define FX_GETBYTEOFFSET32(a) ((FX_BYTE)((a>>16)>>16))
165  #define FX_GETBYTEOFFSET40(a) ((FX_BYTE)(((a>>16)>>16)>>8))
166  #define FX_GETBYTEOFFSET48(a) ((FX_BYTE)(((a>>16)>>16)>>16))
167  #define FX_GETBYTEOFFSET56(a) ((FX_BYTE)((((a>>16)>>16)>>16)>>8))
168  #else
169  #define FX_GETBYTEOFFSET32(a) 0
170  #define FX_GETBYTEOFFSET40(a) 0
171  #define FX_GETBYTEOFFSET48(a) 0
172  #define FX_GETBYTEOFFSET56(a) 0
173  #endif
174  #include <fcntl.h>
175  #include <unistd.h>
176  #include <sys/stat.h>
177 
178  #ifndef O_BINARY
179  #define O_BINARY 0
180  #endif
181  #ifndef O_LARGEFILE
182  #define O_LARGEFILE 0
183  #endif
184 
186  #if defined(_FX_LARGEFILE_SUPPORT_)
187  #if _FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_LINUX_EMBEDDED_ || _FX_OS_ == _FX_ANDROID_
188  // mac and bsd are always 64 bit. use off_t
189  // linux and android uses off64_t
190 #ifndef _CHROME_PNACL_
191  #define _FX_USE_OFF64_T_
192 #endif
193  #endif
194  #endif
195  #if defined(_FX_USE_OFF64_T_)
196  #define FX_FILESIZE off64_t
197  #else
198  #ifndef _CHROME_PNACL_
199  #define FX_FILESIZE off_t
200  #else
201  #define FX_FILESIZE FX_INT32
202  #endif
203  #endif
204  #else //do not support large file.
205 
206  #define FX_FILESIZE FX_INT32
207  #define FX_GETBYTEOFFSET32(a) 0
208  #define FX_GETBYTEOFFSET40(a) 0
209  #define FX_GETBYTEOFFSET48(a) 0
210  #define FX_GETBYTEOFFSET56(a) 0
211  #endif
212  //<<<+++OPENSOURCE_MUST_END
213 
214 #define FX_GETBYTEOFFSET24(a) ((FX_BYTE)(a>>24))
215 #define FX_GETBYTEOFFSET16(a) ((FX_BYTE)(a>>16))
216 #define FX_GETBYTEOFFSET8(a) ((FX_BYTE)(a>>8))
217 #define FX_GETBYTEOFFSET0(a) ((FX_BYTE)(a))
218 
224 #define FX_FILEMODE_Write 0
225 
226 #define FX_FILEMODE_ReadOnly 1
227 
228 #define FX_FILEMODE_Truncate 2 //
229 
241 FX_HFILE FX_File_Open(FX_BSTR fileName, FX_DWORD dwMode, IFX_Allocator* pAllocator = NULL);
252 FX_HFILE FX_File_Open(FX_WSTR fileName, FX_DWORD dwMode, IFX_Allocator* pAllocator = NULL);
261 void FX_File_Close(FX_HFILE hFile, IFX_Allocator* pAllocator = NULL);
262 //<<<+++OPENSOURCE_END
263 
271 FX_FILESIZE FX_File_GetSize(FX_HFILE hFile);
279 FX_FILESIZE FX_File_GetPosition(FX_HFILE hFile);
288 FX_FILESIZE FX_File_SetPosition(FX_HFILE hFile, FX_FILESIZE pos);
298 size_t FX_File_Read(FX_HFILE hFile, void* pBuffer, size_t szBuffer);
309 size_t FX_File_ReadPos(FX_HFILE hFile, void* pBuffer, size_t szBuffer, FX_FILESIZE pos);
319 size_t FX_File_Write(FX_HFILE hFile, const void* pBuffer, size_t szBuffer);
330 size_t FX_File_WritePos(FX_HFILE hFile, const void* pBuffer, size_t szBuffer, FX_FILESIZE pos);
338 FX_BOOL FX_File_Flush(FX_HFILE hFile);
347 FX_BOOL FX_File_Truncate(FX_HFILE hFile, FX_FILESIZE szFile);
348 
356 FX_BOOL FX_File_Exist(FX_BSTR fileName);
364 FX_BOOL FX_File_Exist(FX_WSTR fileName);
372 FX_BOOL FX_File_Delete(FX_BSTR fileName);
380 FX_BOOL FX_File_Delete(FX_WSTR fileName);
389 FX_BOOL FX_File_Copy(FX_BSTR fileNameSrc, FX_BSTR fileNameDst);
398 FX_BOOL FX_File_Copy(FX_WSTR fileNameSrc, FX_WSTR fileNameDst);
407 FX_BOOL FX_File_Move(FX_BSTR fileNameSrc, FX_BSTR fileNameDst);
416 FX_BOOL FX_File_Move(FX_WSTR fileNameSrc, FX_WSTR fileNameDst);
417 
418 //*****************************************************************************
419 //* IFX_StreamWrite/IFX_FileWrite
420 //*****************************************************************************
423 {
424  public:
426  virtual void Release() = 0;
427 
436  virtual FX_BOOL WriteBlock(const void* pData, size_t size) = 0;
442  virtual FX_BOOL Flush() { return TRUE; }
443 
444  protected:
445  virtual ~IFX_StreamWrite() {}
446 };
447 
450 {
451  public:
453  virtual void Release() = 0;
454 
460  virtual FX_FILESIZE GetSize() = 0;
466  virtual FX_BOOL Flush() = 0;
476  virtual FX_BOOL WriteBlock(const void* pData, FX_FILESIZE offset, size_t size) = 0;
485  virtual FX_BOOL WriteBlock(const void* pData, size_t size) {return WriteBlock(pData, GetSize(), size);}
486 
487  protected:
488  virtual ~IFX_FileWrite() {}
489 };
490 
501 
512 //<<<+++OPENSOURCE_END
513 
514 //*****************************************************************************
515 //* IFX_FileRead
516 //*****************************************************************************
519 {
520  public:
526  virtual void Release() = 0;
527 
533  virtual FX_BOOL IsEOF() = 0;
539  virtual FX_FILESIZE GetPosition() = 0;
548  virtual size_t ReadBlock(void* buffer, size_t size) = 0;
549 
550  protected:
551  virtual ~IFX_StreamRead() {}
552 };
553 
556 {
557  public:
563  virtual void Release() = 0;
564 
570  virtual FX_FILESIZE GetSize() = 0;
576  virtual FX_BOOL IsEOF() {return FALSE;}
582  virtual FX_FILESIZE GetPosition() {return 0;}
591  virtual FX_BOOL SetRange(FX_FILESIZE offset, FX_FILESIZE size) {return FALSE;}
597  virtual void ClearRange() {}
607  virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) = 0;
616  virtual size_t ReadBlock(void* buffer, size_t size) {return 0;}
617 
618  protected:
619  virtual ~IFX_FileRead() {}
620 };
621 
631 IFX_FileRead* FX_CreateFileRead(FX_LPCSTR filename, IFX_Allocator* pAllocator = NULL);
632 
643 //<<<+++OPENSOURCE_END
644 
645 //*****************************************************************************
646 //* IFX_FileStream
647 //*****************************************************************************
650 : public IFX_FileRead, public IFX_FileWrite
651 {
652  public:
658  virtual IFX_FileStream* Retain() = 0;
664  virtual void Release() = 0;
665 
671  virtual FX_FILESIZE GetSize() = 0;
677  virtual FX_BOOL IsEOF() = 0;
683  virtual FX_FILESIZE GetPosition() = 0;
684 
694  virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) = 0;
703  virtual size_t ReadBlock(void* buffer, size_t size) = 0;
704 
714  virtual FX_BOOL WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) = 0;
723  virtual FX_BOOL WriteBlock(const void* buffer, size_t size) {return WriteBlock(buffer, GetSize(), size);}
724 
730  virtual FX_BOOL Flush() = 0;
731 
732  protected:
733  virtual ~IFX_FileStream() {}
734 };
735 
746 IFX_FileStream* FX_CreateFileStream(FX_LPCSTR filename, FX_DWORD dwModes, IFX_Allocator* pAllocator = NULL);
747 
758 IFX_FileStream* FX_CreateFileStream(FX_LPCWSTR filename, FX_DWORD dwModes, IFX_Allocator* pAllocator = NULL);
759 //<<<+++OPENSOURCE_END
760 
761 //*****************************************************************************
762 //* IFX_FileAccess
763 //*****************************************************************************
766 {
767  public:
773  virtual void Release() = 0;
774 
780  virtual IFX_FileAccess* Retain() = 0;
788  virtual void GetPath(CFX_WideString& wsPath) = 0;
789 
797  virtual IFX_FileStream* CreateFileStream(FX_DWORD dwModes) = 0;
798 
799  protected:
800  virtual ~IFX_FileAccess() {}
801 };
802 
813 
814 class IFX_FileCollection
815 {
816  public:
817  virtual void Release() = 0;
818 
819  virtual FX_POSITION GetStartPos() = 0;
820  virtual IFX_FileAccess* GetNextFile(FX_POSITION& pos) = 0;
821 
822  protected:
823  virtual ~IFX_FileCollection() {}
824 };
825 //<<<+++OPENSOURCE_END
826 
827 //*****************************************************************************
828 //* Memory stream
829 //*****************************************************************************
832 {
833  public:
834  virtual ~IFX_MemoryStream() {}
835 
841  virtual FX_BOOL IsConsecutive() const = 0;
855  virtual void EstimateSize(size_t nInitSize, size_t nGrowSize) = 0;
864  virtual FX_LPBYTE GetBuffer() const = 0;
879  virtual void AttachBuffer(FX_LPBYTE pBuffer, size_t nSize, FX_BOOL bTakeOver = FALSE) = 0;
887  virtual void DetachBuffer() = 0;
888 };
902 IFX_MemoryStream* FX_CreateMemoryStream(FX_LPBYTE pBuffer, size_t nSize, FX_BOOL bTakeOver = FALSE, IFX_Allocator* pAllocator = NULL);
903 
915 IFX_MemoryStream* FX_CreateMemoryStream(FX_BOOL bConsecutive = FALSE, IFX_Allocator* pAllocator = NULL);
916 //<<<+++OPENSOURCE_END
917 
918 //*****************************************************************************
919 //* Buffer read stream
920 //*****************************************************************************
927 {
928  public:
934  virtual void Release() = 0;
935 
941  virtual FX_BOOL IsEOF() = 0;
947  virtual FX_FILESIZE GetPosition() = 0;
948 
957  virtual size_t ReadBlock(void* buffer, size_t size) = 0;
958 
966  virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) = 0;
972  virtual FX_LPCBYTE GetBlockBuffer() = 0;
978  virtual size_t GetBlockSize() = 0;
986  virtual FX_FILESIZE GetBlockOffset() = 0;
987 
988  protected:
989  virtual ~IFX_BufferRead() {}
990 };
991 
992 //*****************************************************************************
993 //* Cached file read
994 //*****************************************************************************
995 #define FX_FILECACHE_CHUNKSIZE 32768
996 #define FX_FILECACHE_CHUNKCOUNT 64
997 
999 class CFX_CachedFileRead : public IFX_FileStream, public CFX_Object
1000 {
1001  public:
1003  virtual ~CFX_CachedFileRead();
1004 
1016  FX_BOOL Init(FX_INT32 nChunkSize, FX_INT32 nChunkCount, FX_LPVOID pBuffer, IFX_Allocator* pAllocator = NULL);
1025  FX_BOOL AttachFile(IFX_FileRead* pFile, FX_BOOL bTakeOver);
1034  FX_BOOL PreCache(FX_FILESIZE offset, FX_INT32 nCacheCount);
1035 
1041  virtual FX_FILESIZE GetSize();
1047  virtual FX_BOOL IsEOF();
1053  virtual FX_FILESIZE GetPosition();
1054 
1064  virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size);
1073  virtual size_t ReadBlock(void* buffer, size_t size);
1074 
1075  protected:
1076  FXMT_LOCKOBJECT_DEFINE(m_LockObj);
1077  FX_LPVOID m_pData;
1078  FX_DWORD m_dwCount;
1079 
1080  /* @brief Create a shared instance. */
1081  virtual IFX_FileStream* Retain();
1082  /* @brief Called when to release everything */
1083  virtual void Release();
1084  /* @brief Write a block data into stream. Unsupported for reading mode, return FALSE directly. */
1085  virtual FX_BOOL WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) {return FALSE;}
1086  /* @brief Flush internal buffer. Unsupported for reading mode, return FALSE directly. */
1087  virtual FX_BOOL Flush() {return FALSE;}
1088 };
1089 //<<<+++OPENSOURCE_END
1090 
1091 //<<<+++OPENSOURCE_MUST_BEGIN
1092 #endif // _FX_STREAM_H_
1093 //<<<+++OPENSOURCE_MUST_END
1094 
1097 //<<<+++OPENSOURCE_END
virtual void GetPath(CFX_WideString &wsPath)=0
Get current path string.
virtual FX_BOOL ReadBlock(void *buffer, FX_INT64 offset, size_t size)=0
Read a data block from the file.
IFX_MemoryStream * FX_CreateMemoryStream(FX_LPBYTE pBuffer, size_t nSize, FX_BOOL bTakeOver=0, IFX_Allocator *pAllocator=0)
Creates a stream object by a given memory buffer. This function creates a consecutive memory stream o...
virtual FX_INT64 GetSize()
Get total size of the file.
void * FX_LPVOID
Pointer to any type.
Definition: fx_system.h:633
Memory stream interface.
Definition: fx_stream.h:831
virtual size_t ReadBlock(void *buffer, size_t size)
Read data block from stream.
Definition: fx_stream.h:616
wchar_t FX_WCHAR
Compiler dependant Unicode character (16-bit for Microsoft Compiler, 32-bit for gcc).
Definition: fx_system.h:708
virtual void Release()=0
Called when to release everything.
IFX_FileAccess * FX_CreateDefaultFileAccess(FX_WSTR wsPath, IFX_Allocator *pAllocator=0)
Create a CRT based file I/O interface.
File writing interface.
Definition: fx_stream.h:449
unsigned long FX_DWORD
32-bit unsigned integer.
Definition: fx_system.h:698
FX_BOOL AttachFile(IFX_FileRead *pFile, FX_BOOL bTakeOver)
Attach a file read.
virtual void Release()=0
Destroy the current instance.
CONSTANT WIDE STRING CLASS.
Definition: fx_string.h:1216
virtual FX_BOOL WriteBlock(const void *pData, FX_INT64 offset, size_t size)=0
Write a block data.
virtual FX_BOOL SetRange(FX_INT64 offset, FX_INT64 size)
Set accessing range.
Definition: fx_stream.h:591
FX_BOOL FX_File_Exist(FX_BSTR fileName)
Determine whether a file exists or not.
void FX_File_Close(FX_HFILE hFile, IFX_Allocator *pAllocator=0)
Close file.
FX_BOOL FX_File_Copy(FX_BSTR fileNameSrc, FX_BSTR fileNameDst)
Copy file.
virtual void Release()=0
Destroy the current instance.
virtual FX_BOOL IsEOF()=0
Determine whether reach the end of stream.
virtual FX_LPBYTE GetBuffer() const =0
Get the current memory buffer.
void FX_CloseFolder(void *handle)
Close folder handle.
virtual FX_LPCBYTE GetBlockBuffer()=0
Get internal buffer of block data.
FX_WCHAR FX_GetFolderSeparator()
Get folder separator for the system. Most likely it&#39;s either /&#39; or &#39;\&#39;.
virtual size_t ReadBlock(void *buffer, size_t size)=0
Read data block from sequential stream.
virtual FX_BOOL IsEOF()=0
Determine whether reach the end of stream.
virtual FX_INT64 GetPosition()
Get the current reading position in stream.
Definition: fx_stream.h:582
wchar_t const * FX_LPCWSTR
Pointer to constant Unicode characters.
Definition: fx_system.h:712
virtual void Release()=0
Called when to release everything.
size_t FX_File_WritePos(FX_HFILE hFile, const void *pBuffer, size_t szBuffer, FX_INT64 pos)
Write data at specified position.
FX_BOOL FX_GetNextFile(void *handle, CFX_ByteString &filename, FX_BOOL &bFolder, FX_LPCSTR absPath=0)
Read next entry in the folder.
FX_HFILE FX_File_Open(FX_BSTR fileName, FX_DWORD dwMode, IFX_Allocator *pAllocator=0)
Open file with specified accessing mode.
FX_BOOL Init(FX_INT32 nChunkSize, FX_INT32 nChunkCount, FX_LPVOID pBuffer, IFX_Allocator *pAllocator=0)
Initialize the chunk size and chunk count.
Cached file read interface.
Definition: fx_stream.h:999
virtual void Release()=0
Called when to release everything.
virtual void AttachBuffer(FX_LPBYTE pBuffer, size_t nSize, FX_BOOL bTakeOver=0)=0
Attach a memory buffer.
File reading interface.
Definition: fx_stream.h:555
WIDE STRING CLASS.
Definition: fx_string.h:1463
Stream writing interface.
Definition: fx_stream.h:422
void * FX_POSITION
A value used to denote the position of an element in a collection.
Definition: fx_system.h:637
size_t FX_File_Read(FX_HFILE hFile, void *pBuffer, size_t szBuffer)
Read data from the current file accessing position.
virtual FX_INT64 GetPosition()=0
Get the current reading position in stream.
virtual FX_INT64 GetPosition()
Get the current reading position in stream.
virtual FX_BOOL WriteBlock(const void *buffer, size_t size)
Write a block data to the end of current stream.
Definition: fx_stream.h:723
Stream reading interface.
Definition: fx_stream.h:518
virtual FX_BOOL IsEOF()
Determine whether reach the end of stream.
Definition: fx_stream.h:576
size_t FX_File_Write(FX_HFILE hFile, const void *pBuffer, size_t szBuffer)
Write data from the current file accessing position.
virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart=0)=0
Read the next block in sequential stream.
virtual FX_BOOL Flush()=0
Flush internal buffer of the file.
IFX_BufferRead stream provides an optimized approach to read stream data. Usually, one stream maintains an internal buffer for data access, this buffer can be used directly to caller, and avoids data-copy.
Definition: fx_stream.h:926
int FX_INT32
32-bit signed integer.
Definition: fx_system.h:662
IFX_FileWrite * FX_CreateFileWrite(FX_LPCSTR filename, IFX_Allocator *pAllocator=0)
(Available only for platforms supporting CRT file access (fopen, ...)) Create a CRT based file writin...
size_t FX_File_ReadPos(FX_HFILE hFile, void *pBuffer, size_t szBuffer, FX_INT64 pos)
Read data from specified position.
virtual FX_INT64 GetBlockOffset()=0
Get the offset of data in internal buffer.
virtual size_t GetBlockSize()=0
Get the size of data in internal buffer.
int FX_BOOL
Boolean variable (should be TRUE or FALSE).
Definition: fx_system.h:666
File access interface, open file.
Definition: fx_stream.h:765
FX_BOOL FX_CreateFolder(FX_LPCSTR path)
Create new folder.
void * FX_OpenFolder(FX_LPCSTR path)
Open a folder for reading.
virtual void Release()
Destroy the current instance.
virtual FX_BOOL Flush()
Flush stream data.
Definition: fx_stream.h:442
char const * FX_LPCSTR
Pointer to constant 8-bit Windows (ANSI) characters.
Definition: fx_system.h:679
virtual FX_BOOL Flush()
Flush internal buffer.
Definition: fx_stream.h:1087
FX_BOOL FX_IsFilePathExist(FX_LPCWSTR path)
Check if the path exists, including file path and folder path.
File stream interface, reading & writing.
Definition: fx_stream.h:649
virtual IFX_FileAccess * Retain()=0
Create a shared instance.
virtual FX_BOOL IsEOF()
Determine whether reach the end of stream.
virtual FX_BOOL WriteBlock(const void *pData, size_t size)
Write a block data to the end.
Definition: fx_stream.h:485
virtual IFX_FileStream * Retain()
Create a shared instance.
virtual FX_BOOL WriteBlock(const void *buffer, FX_INT64 offset, size_t size)
Write a block data into stream.
Definition: fx_stream.h:1085
FX_BOOL FX_File_Move(FX_BSTR fileNameSrc, FX_BSTR fileNameDst)
Move file.
unsigned char * FX_LPBYTE
Pointer to a FX_BYTE.
Definition: fx_system.h:646
virtual FX_INT64 GetSize()=0
Get total size of the file.
FX_BOOL FX_File_Delete(FX_BSTR fileName)
Delete file.
FX_INT64 FX_File_GetPosition(FX_HFILE hFile)
Get the current file accessing position.
Foxit allocator interface.
Definition: fx_memory.h:960
virtual FX_BOOL WriteBlock(const void *buffer, FX_INT64 offset, size_t size)=0
Write a block data into stream.
FX_BOOL FX_File_Flush(FX_HFILE hFile)
Flush internal buffer if need.
virtual void ClearRange()
Clear accessing range set by function IFX_FileRead::SetRange.
Definition: fx_stream.h:597
virtual FX_INT64 GetPosition()=0
Get the current reading position in stream.
FX_INT64 FX_File_GetSize(FX_HFILE hFile)
Get file size.
virtual size_t ReadBlock(void *buffer, size_t size)=0
Read data block from sequential stream.
virtual FX_INT64 GetSize()=0
Get total size of the file.
#define TRUE
Keyword which value is 1.
Definition: fx_system.h:757
virtual FX_BOOL Flush()=0
Flush internal buffer.
virtual FX_BOOL IsEOF()=0
Determine whether reach the end of stream.
virtual void DetachBuffer()=0
Detach the current memory buffer.
virtual FX_INT64 GetSize()=0
Get the current stream size, in bytes.
virtual FX_BOOL ReadBlock(void *buffer, FX_INT64 offset, size_t size)=0
Read a data block from stream.
CONSTANT BYTE STRING CLASS.
Definition: fx_string.h:51
virtual void Release()=0
Called when to release everything.
virtual FX_INT64 GetPosition()=0
Get the current reading position in stream.
FX_BOOL FX_File_Truncate(FX_HFILE hFile, FX_INT64 szFile)
Truncate file size.
virtual FX_BOOL WriteBlock(const void *pData, size_t size)=0
Write a block data.
FX_BOOL PreCache(FX_INT64 offset, FX_INT32 nCacheCount)
Attach a file read.
BYTE STRING CLASS.
Definition: fx_string.h:317
IFX_FileRead * FX_CreateFileRead(FX_LPCSTR filename, IFX_Allocator *pAllocator=0)
(Available only for platforms supporting CRT file access) Create a CRT based file reading interface...
unsigned char const * FX_LPCBYTE
Pointer to a constant FX_BYTE.
Definition: fx_system.h:648
IFX_FileStream * FX_CreateFileStream(FX_LPCSTR filename, FX_DWORD dwModes, IFX_Allocator *pAllocator=0)
(Available only for platforms supporting CRT file access) Create a CRT based file I/O interface...
Header file for Memory management related definitions and classes.
#define FALSE
Keyword which value is 0.
Definition: fx_system.h:762
virtual IFX_FileStream * Retain()=0
Create a shared instance.
#define NULL
The null-pointer value.
Definition: fx_system.h:767
#define FX_DEFINEHANDLE(name)
Macro to define a handle type.
Definition: fx_system.h:749
#define FX_FILESIZE
Support large file directly.
Definition: fx_stream.h:138
virtual FX_BOOL ReadBlock(void *buffer, FX_INT64 offset, size_t size)
Read a data block from the file.
virtual IFX_FileStream * CreateFileStream(FX_DWORD dwModes)=0
Create IFX_FileStream to operate file.
virtual FX_BOOL IsConsecutive() const =0
Determine whether the current mode is consecutive or not.
virtual void EstimateSize(size_t nInitSize, size_t nGrowSize)=0
Change initialize size and grow size.
virtual void Release()=0
Called when to release the current instance.
FX_INT64 FX_File_SetPosition(FX_HFILE hFile, FX_INT64 pos)
Set the current file accessing position.

Foxit Software Corporation Logo
@2018 Foxit Software Incorporated. All rights reserved.