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 EmbeddedStream.cpp
11 #include "EmbeddedStream.h"
16 EmbeddedStream::EmbeddedStream(DataStream
&stream
, off_t offset
, size_t size
)
17 : SimulatedStream(stream
)
23 /*! \brief Returns the largest extent in the underlying data stream
24 corresponding to the extent starting at byte position \a pos of
25 byte length \a size in the output parameter \a extent.
27 NOTE: If the position is at or beyond the end of the stream, the
28 function will return B_OK, but the value of extent.size will be 0.
31 EmbeddedStream::_GetExtent(off_t pos
, size_t size
, data_extent
&extent
)
35 extent
.offset
= fOffset
+ fSize
;
39 extent
.offset
= fOffset
+ pos
;
40 extent
.size
= fSize
- pos
;
45 /*! \brief Returns the current size of the stream.
48 EmbeddedStream::_Size()