split to input stream and output stream