blob: 3d381d545ef73e10819aa5e449e3be51aaa63f5b [file] [log] [blame]
Brian Carlstromdb4d5402011-08-09 12:18:28 -07001// Copyright 2010 Google Inc. All Rights Reserved.
2
3#ifndef ART_SRC_FILE_LINUX_H_
4#define ART_SRC_FILE_LINUX_H_
5
6#include "file.h"
7
8namespace art {
9
10class LinuxFile : public File {
11 public:
12 LinuxFile(const char* name, int fd, bool auto_close) :
13 File(name), fd_(fd), auto_close_(auto_close) {}
14 virtual ~LinuxFile();
15
16 virtual void Close();
17 virtual bool IsClosed();
18
19 virtual int64_t Read(void* buffer, int64_t num_bytes);
20 virtual int64_t Write(const void* buffer, int64_t num_bytes);
21
22 virtual off_t Length();
23 virtual off_t Position();
24
Brian Carlstrom4a289ed2011-08-16 17:17:49 -070025 virtual int Fd() {
26 return fd_;
27 }
28
Brian Carlstromdb4d5402011-08-09 12:18:28 -070029 private:
30 static const int kClosedFd = -1;
31
32 int fd_;
33 bool auto_close_;
34};
35
36} // namespace art
37
38#endif // ART_SRC_FILE_LINUX_H_