added new functionality setBuffer() to change buffer pointer location