add stream and buffer support