bytestream: add functions for accessing size of buffer