xref: /haiku/src/tools/restest/OffsetFile.h (revision fce4895d1884da5ae6fb299d23c735c598e690b1)
1 // OffsetFile.h
2 
3 #ifndef OFFSET_FILE_H
4 #define OFFSET_FILE_H
5 
6 #include <DataIO.h>
7 #include <File.h>
8 
9 class OffsetFile : public BPositionIO {
10 public:
11 								OffsetFile();
12 								OffsetFile(const BFile& file, off_t offset);
13 	virtual						~OffsetFile();
14 
15 			status_t			SetTo(const BFile& file, off_t offset);
16 			void				Unset();
17 			status_t			InitCheck() const;
18 
19 //			ssize_t				Read(void *buffer, size_t size);
20 //			ssize_t				Write(const void *buffer, size_t size);
21 			ssize_t				ReadAt(off_t pos, void *buffer, size_t size);
22 			ssize_t				WriteAt(off_t pos, const void *buffer,
23 										size_t size);
24 			off_t				Seek(off_t position, uint32 seekMode);
25 			off_t				Position() const;
26 			status_t			SetSize(off_t size);
27 			status_t			GetSize(off_t* size);
28 
29 			off_t				GetOffset() const;
30 
31 private:
32 			BFile				fFile;
33 			off_t				fOffset;
34 			off_t				fCurrentPosition;
35 };
36 
37 #endif	// OFFSET_FILE_H
38