use writestream