import logging # Handle efficient operations on a non-fixed length buffer like appending, # replacing, reading chunks, etc class ChunkBuffer: def __init__( self, data = '' ): logging.debug( "Creating chunkbuffer: %s" % data ) self.chunk = list( data ) def append( self, s ): self.chunk.extend( list( s ) ) def replace( self, s, start, end ): self.chunk def length( self ): return len( self.chunk ) def string(self): logging.debug( "Stringifying: %s" % self.chunk ) return ''.join( self.chunk )