Added tests and fixed bug revealed by same

Added tests for outputStream  and  outputStreamEncrypted tests to make
sure outputsreams are tested independent of copyFrom since copyFrom no
longer leverages the outputstream. Fixed bug revealed by the tests.
Added .idea to .gitignore