Code example for PipedOutputStream

0
			InputStream imageStream = null;
 
			imageStream = MainActivity.getNetworkController().getFileStream(MainActivity.getContext(), mFriend.getImageUrl());
 
			if (!mCancelled && imageStream != null) {
				PipedOutputStream out = new PipedOutputStream();
				PipedInputStream inputStream;
				try { 
					inputStream = new PipedInputStream(out);
 
					EncryptionController.runDecryptTask(mFriend.getImageVersion(), IdentityController.getLoggedInUser(),
							mFriend.getImageVersion(), mFriend.getImageIv(), new BufferedInputStream(imageStream), out);
 
					if (mCancelled) {
						inputStream.close();
						return; 
					} 
 
					byte[] bytes = Utils.inputStreamToBytes(inputStream);
					if (mCancelled) {
						return;