use bufferscanner to implement copy
safe iterator for buffer
whitespace