1 //----------------------------------------------------------------------
2 // This software is part of the OpenBeOS distribution and is covered
5 // Copyright (c) 2003 Tyler Dauwalder, tyler@dauwalder.net
6 //----------------------------------------------------------------------
8 /*! \file PositionIOStream.h
11 #ifndef _POSITION_IO_STREAM_H
12 #define _POSITION_IO_STREAM_H
16 #include "DataStream.h"
18 /*! \brief DataStream implementation that writes to a BPositionIO.
20 class PositionIOStream
: public DataStream
{
22 PositionIOStream(BPositionIO
&stream
);
23 virtual status_t
InitCheck() const { return B_OK
; }
25 static const size_t kBufferSize
= 32 * 1024;
27 virtual ssize_t
Read(void *buffer
, size_t size
);
28 virtual ssize_t
ReadAt(off_t pos
, void *buffer
, size_t size
);
30 virtual ssize_t
Write(const void *buffer
, size_t size
);
31 virtual ssize_t
WriteAt(off_t pos
, const void *buffer
, size_t size
);
33 virtual ssize_t
Write(BDataIO
&data
, size_t size
);
34 virtual ssize_t
WriteAt(off_t pos
, BDataIO
&data
, size_t size
);
36 virtual ssize_t
Zero(size_t size
);
37 virtual ssize_t
ZeroAt(off_t pos
, size_t size
);
39 virtual off_t
Seek(off_t position
, uint32 seek_mode
);
40 virtual off_t
Position() const;
42 virtual status_t
SetSize(off_t size
);
47 #endif // _POSITION_IO_STREAM_H