refactor: extract method from doc_flush_binaries. add with_stream/2 to handle automatically opening and closing binary streams.
refactor: extract method from doc_flush_binaries. add with_stream/2 to handle automatically opening and closing binary streams.


git-svn-id: c1f8a8ec0b3bb2e99ab3413722f81f687760e79c@764257 13f79535-47bb-0310-9956-ffa450edef68

benoitc/couchit_experiment,benoitc/couchit_experiment,PerilousApricot/bigcouch,Gussy/bigcouch,benoitc/bigcouch,andrejb/cloudant_bigcouch,georgemarshall/bigcouch,georgemarshall/bigcouch,davidcoallier/bigcouch,fkaempfer/couchdb,linearregression/bigcouch,georgemarshall/bigcouch,KlausTrainer/bigcouch,davidcoallier/bigcouch,linearregression/bigcouch,Asquera/bigcouch,PerilousApricot/bigcouch,Gussy/bigcouch,andrejb/cloudant_bigcouch,breezjw/bigcouch,Gussy/bigcouch,fkaempfer/couchdb,benoitc/couchit_experiment,benoitc/couchit_experiment,bittorrent/bigcouch,davidcoallier/bigcouch,PerilousApricot/bigcouch,PerilousApricot/bigcouch,linearregression/bigcouch,bittorrent/bigcouch,Gussy/bigcouch,linearregression/bigcouch,KlausTrainer/bigcouch,davidcoallier/bigcouch,cloudant/bigcouch,breezjw/bigcouch,linearregression/bigcouch,georgemarshall/bigcouch,georgemarshall/bigcouch,cloudant/bigcouch,andrejb/cloudant_bigcouch,kofron/bigcouch,Asquera/bigcouch,breezjw/bigcouch,KlausTrainer/bigcouch,andrejb/cloudant_bigcouch,kofron/bigcouch,benoitc/bigcouch,linearregression/bigcouch,kofron/bigcouch,breezjw/bigcouch,benoitc/bigcouch,fkaempfer/couchdb,kofron/bigcouch,linearregression/bigcouch,PerilousApricot/bigcouch,cloudant/bigcouch,davidcoallier/bigcouch,fkaempfer/couchdb,breezjw/bigcouch,cloudant/bigcouch,cloudant/bigcouch,KlausTrainer/bigcouch,bittorrent/bigcouch,Asquera/bigcouch,fkaempfer/couchdb,benoitc/bigcouch,benoitc/bigcouch,kofron/bigcouch,andrejb/cloudant_bigcouch,breezjw/bigcouch,bittorrent/bigcouch,kofron/bigcouch,andrejb/cloudant_bigcouch,cloudant/bigcouch,Asquera/bigcouch,davidcoallier/bigcouch,PerilousApricot/bigcouch,cloudant/bigcouch,fkaempfer/couchdb,georgemarshall/bigcouch,KlausTrainer/bigcouch,Asquera/bigcouch,bittorrent/bigcouch,benoitc/couchit_experiment,KlausTrainer/bigcouch,Asquera/bigcouch,benoitc/bigcouch,bittorrent/bigcouch,andrejb/cloudant_bigcouch,Gussy/bigcouch,Gussy/bigcouch