1 //----------------------------------------------------------------------
2 // This software is part of the OpenBeOS distribution and is covered
4 //---------------------------------------------------------------------
7 OffsetFile interface declaration.
10 #ifndef _OFFSET_FILE_H
11 #define _OFFSET_FILE_H
21 \brief Provides access to a file skipping a certain amount of bytes at
24 This class implements the BPositionIO interface to provide access to the
25 data of a file past a certain offset. This is very handy e.g. for dealing
26 with resources, as they always reside at the end of a file, but may start
29 \author <a href='mailto:bonefish@users.sf.net'>Ingo Weinhold</a>
33 class OffsetFile
: public BPositionIO
{
36 OffsetFile(BFile
*file
, off_t offset
);
37 virtual ~OffsetFile();
39 status_t
SetTo(BFile
*file
, off_t offset
);
41 status_t
InitCheck() const;
45 ssize_t
ReadAt(off_t pos
, void *buffer
, size_t size
);
46 ssize_t
WriteAt(off_t pos
, const void *buffer
,
48 off_t
Seek(off_t position
, uint32 seekMode
);
49 off_t
Position() const;
51 status_t
SetSize(off_t size
);
52 status_t
GetSize(off_t
*size
) const;
59 off_t fCurrentPosition
;
62 }; // namespace Storage
63 }; // namespace BPrivate
65 #endif // _OFFSET_FILE_H