Shaka Packager SDK
Loading...
Searching...
No Matches
local_file.h
1// Copyright 2014 Google LLC. 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#ifndef PACKAGER_FILE_LOCAL_FILE_H_
8#define PACKAGER_FILE_LOCAL_FILE_H_
9
10#include <cstdint>
11#include <cstdio>
12#include <string>
13
14#include <packager/file.h>
15#include <packager/macros/classes.h>
16
17namespace shaka {
18
20class LocalFile : public File {
21 public:
25 LocalFile(const char* file_name, const char* mode);
26
29 bool Close() override;
30 int64_t Read(void* buffer, uint64_t length) override;
31 int64_t Write(const void* buffer, uint64_t length) override;
32 void CloseForWriting() override;
33 int64_t Size() override;
34 bool Flush() override;
35 bool Seek(uint64_t position) override;
36 bool Tell(uint64_t* position) override;
38
42 static bool Delete(const char* file_name);
43
44 protected:
45 ~LocalFile() override;
46
47 bool Open() override;
48
49 private:
50 std::string file_mode_;
51 FILE* internal_file_;
52
53 DISALLOW_COPY_AND_ASSIGN(LocalFile);
54};
55
56} // namespace shaka
57
58#endif // PACKAGER_FILE_LOCAL_FILE_H_
Implement LocalFile which deals with local storage.
Definition local_file.h:20
static bool Delete(const char *file_name)
All the methods that are virtual are virtual for mocking.