blob: 7e36adaf94f03c96605f838967043c36210fb861 [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
25 private:
26 static const int kClosedFd = -1;
27
28 int fd_;
29 bool auto_close_;
30};
31
32} // namespace art
33
34#endif // ART_SRC_FILE_LINUX_H_