7 #ifndef PACKAGER_FILE_FILE_H_
8 #define PACKAGER_FILE_FILE_H_
14 #include "packager/base/macros.h"
16 namespace edash_packager {
19 extern const char* kLocalFilePrefix;
43 static bool Delete(
const char* file_name);
50 virtual bool Close() = 0;
58 virtual int64_t
Read(
void* buffer, uint64_t length) = 0;
64 virtual int64_t
Write(
const void* buffer, uint64_t length) = 0;
68 virtual int64_t
Size() = 0;
75 virtual bool Flush() = 0;
80 virtual bool Seek(uint64_t position) = 0;
86 virtual bool Tell(uint64_t* position) = 0;
89 const std::string&
file_name()
const {
return file_name_; }
111 static bool Copy(
const char* from_file_name,
const char* to_file_name);
114 explicit File(
const std::string& file_name) : file_name_(file_name) {}
120 virtual bool Open() = 0;
127 static File* Create(
const char* file_name,
const char* mode);
129 static File* CreateInternalFile(
const char* file_name,
const char* mode);
131 std::string file_name_;
132 DISALLOW_COPY_AND_ASSIGN(
File);
138 #endif // PACKAGER_FILE_FILE_H_