Revert "Changes to be able to transport bytes with UnbufferedOutputFile. Streaming quality still needs to be improved."

This reverts commit e879b7da5be78a91931a7253541c88233a190175.
Revert "Removed unused variables and methods"

This reverts commit ee7e087b2050d6173eecf5b63a976e675aa8250b.