If stream is a buffer stream, use raw buffer sizes, not string sizes