Get the total buffer length of a stream.