Shaka Packager SDK
callback_file.h
1 // Copyright 2017 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #include "packager/file/file.h"
8 
9 namespace shaka {
10 
13 class CallbackFile : public File {
14  public:
20  CallbackFile(const char* file_name, const char* mode);
21 
24  bool Close() override;
25  int64_t Read(void* buffer, uint64_t length) override;
26  int64_t Write(const void* buffer, uint64_t length) override;
27  int64_t Size() override;
28  bool Flush() override;
29  bool Seek(uint64_t position) override;
30  bool Tell(uint64_t* position) override;
32 
33  protected:
34  ~CallbackFile() override;
35 
36  bool Open() override;
37 
38  private:
39  CallbackFile(const CallbackFile&) = delete;
40  CallbackFile& operator=(const CallbackFile&) = delete;
41 
42  const BufferCallbackParams* callback_params_ = nullptr;
43  std::string name_;
44  std::string file_mode_;
45 };
46 
47 } // namespace shaka
CallbackFile(const char *file_name, const char *mode)
bool Seek(uint64_t position) override
int64_t Read(void *buffer, uint64_t length) override
int64_t Write(const void *buffer, uint64_t length) override
bool Close() override
int64_t Size() override
bool Open() override
Internal open. Should not be used directly.
bool Tell(uint64_t *position) override
bool Flush() override
Define an abstract file interface.
Definition: file.h:27
const std::string & file_name() const
Definition: file.h:95
All the methods that are virtual are virtual for mocking.