Module prototypes :: Class buffer
[hide private]
[frames] | no frames]

Class buffer

source code

object --+
         |
        buffer

This is used for reading and writing byte data

Instance Methods [hide private]
 
__init__(self, data=None)
Call with data to read from it, or with None to write to it
source code
 
reset(self, data=None)
Call with data to read from it, or with None to write to it
source code
 
getcurrentoffset(self)
Returns distance into data we are
source code
 
setcurrentoffset(self, ofs)
Set the current offset
source code
 
peeknextbyte(self, howmuch=0)
Returns value of next byte, but doesn't advance position
source code
 
getnextbyte(self)
Returns next byte
source code
 
getnextbytes(self, howmany)
Returns howmany bytes
source code
 
peeknextbytes(self, howmany) source code
 
getremainingbytes(self)
Returns rest of buffer
source code
 
discardnextbytes(self, howmany)
Discards howmany bytes
source code
 
discardremainingbytes(self)
Discards the rest of the buffer
source code
 
hasmore(self)
Is there any data left?
source code
 
howmuchmore(self)
Returns how many bytes left
source code
 
appendbyte(self, val)
Appends byte to data.
source code
 
appendbytes(self, bytes)
Adds bytes to end
source code
 
getvalue(self)
Returns the buffer being built
source code
 
getdata(self)
Returns the data passed in
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]
  offset
Returns distance into data we are

Inherited from object: __class__

Method Details [hide private]

__init__(self, data=None)
(Constructor)

source code 

Call with data to read from it, or with None to write to it

Overrides: object.__init__

appendbyte(self, val)

source code 

Appends byte to data.

Parameters:
  • val - a number 0 <= val <=255

Property Details [hide private]

offset

Returns distance into data we are

Get Method:
getcurrentoffset(self) - Returns distance into data we are
Set Method:
setcurrentoffset(self, ofs) - Set the current offset