Correct read of file during upload to permit blocking.
Change write flush to match dev_4_4 code.
Allow write to write the buffer in chunks.
Have raw file bean flush file metadata.

Will need to be rebased back to dev_4_4.
fix merge conflict with PR #1006
Merge pull request #997 from mtbc/trac-10602

Fix #10602 and clean up IO code. (rebased)