53 if ( fOuter == NULL ) realw =
'i';
57 fSize = fRealOuterSize;
62 fSize = fRealInnerSize;
80 UInt_t lsize = s > 0u ? s : 1u ;
88 if ( fInner == NULL ) {
91 fRealInnerSize = lsize;
149 pos = UInt_t(off -
fBufferIO);
return true;
182 if ( newbuf == NULL )
192 fRealInnerSize = new_size;
218 if ( extbuf == NULL )
221 if ( extbuf == fInner ) {
222 if ( size_ext_buf < fRealInnerSize ) {
229 fOuter =
const_cast<Char_t *
>(extbuf); fRealOuterSize = size_ext_buf;
242 if ( (p1+p2) > extbuf.
Size() )
253 if ( fRealInnerSize < size_ext_buf ) {
260 if ( newbuf != NULL ) {
267 fRealInnerSize = size_ext_buf;
287 UInt_t btoread = size_ext_buf;
290 btoread = size_ext_buf;
300 UInt_t btoread = size_ext_buf;
307 fCurrent += btoread;
return btoread;
313 UInt_t btoread = size_ext_buf <= from.
Size() ? size_ext_buf : from.
Size() ;
320 fCurrent += btoread;
return btoread;
337 UInt_t bwritten = size_buf;
339 if ( size_buf >
Size() )
342 bwritten = (UInt_t)::fwrite(
fBufferIO,1,bwritten,fd);
fCurrent += bwritten;
return bwritten;
347 UInt_t btoread = size_ext_buf;
350 Bool_t oksize =
true;
355 btoread = size_ext_buf;
365 UInt_t bwritten = size_buf;
367 if ( size_buf >
Size() )
375 Char_t *old = fOuter; fOuter = NULL; fRealOuterSize = 0u;
virtual Bool_t Reserve(UInt_t size)
to reserve a given size (from the current position) to be sure one are able to write something ...
Char_t * fBufferIO
current buffer in which data are read/written
Char_t * CurrentAddress()
for classes that needs it to write directly data into it.
virtual Bool_t Link(const Char_t *from, UInt_t from_size)
Link an external buffer to this class.
virtual void Reset()
Reset means set all elements to 0 and the current position is 0.
static void Delete(Char_t *p)
BufferIO(UInt_t s=aByte)
Default size for a BufferIO is one byte just because it could be used only with an external buffer...
Bool_t IsAnOffset(const Char_t *off, UInt_t &pos) const
check if this address belongs to this buffer
static void Zero(Char_t *p, Int_t nb)
A Endianbuffer is used to read/write raw data buffers from/on files.
virtual Char_t * Unlink()
Unlink the external buffer to this class.
UInt_t fRealSize
Real size of the current buffer.
UInt_t Offset() const
it returns the current position in the buffer
UInt_t Size() const
it returns the maximum number of bytes in this buffer
UInt_t fCurrent
current position in the buffer (mutable so that reading are allowed for constant) ...
static bool IsSysEndian(BaseBuffer::EEndian e)
check out the endian type of the running system
static EEndian SysEndian()
header file for BufferIO.cpp
UInt_t FreeSize() const
it returns the number of free bytes to the end
void SetCurrent(const char= 'i')
to switch between inner and outer
const Char_t * GetAddress() const
Pointer to the current underlying array of bytes.
virtual UInt_t Export(Char_t *, UInt_t) const
Export this buffer to an array.
static void Copy(const void *from, void *to, Int_t size)
copy the content from -> to
EndianBufferIO(UInt_t s=aKByte)
virtual Bool_t Copy(const Char_t *from, UInt_t from_size)
copy an external buffer to this.
static BufferIO * New(BaseBuffer::EEndian e, UInt_t s=aByte)
return the right buffer taking Into account the endian argument compared to the underlying endian sys...
virtual Bool_t Expand(UInt_t new_size)
Expand the size of the current buffer.
static Char_t * New(Char_t *p, Int_t nb=32 *aKByte)
UInt_t SetEffectiveSize(UInt_t size=kMaxUInt_t)
in case the buffer is partly filled and you would like to read it again
void SetEndian(BaseBuffer::EEndian e)
UInt_t Import(const Char_t *from, UInt_t size_ext_buf)
Import the given array in this buffer.
virtual ~EndianBufferIO()
EStatus fStatus
current status
UInt_t fSize
effective size of the current buffer
EEndian fEndian
current endian
UInt_t SetOffset(UInt_t off=0u) const
change the current position.