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;
20 const int64_t kWholeFile = -1;
44 static bool Delete(
const char* file_name);
51 virtual bool Close() = 0;
59 virtual int64_t
Read(
void* buffer, uint64_t length) = 0;
65 virtual int64_t
Write(
const void* buffer, uint64_t length) = 0;
69 virtual int64_t
Size() = 0;
76 virtual bool Flush() = 0;
81 virtual bool Seek(uint64_t position) = 0;
87 virtual bool Tell(uint64_t* position) = 0;
90 const std::string&
file_name()
const {
return file_name_; }
112 static bool Copy(
const char* from_file_name,
const char* to_file_name);
128 explicit File(
const std::string& file_name) : file_name_(file_name) {}
134 virtual bool Open() = 0;
141 static File* Create(
const char* file_name,
const char* mode);
143 static File* CreateInternalFile(
const char* file_name,
const char* mode);
145 std::string file_name_;
146 DISALLOW_COPY_AND_ASSIGN(
File);
152 #endif // PACKAGER_FILE_FILE_H_