Code example for PipedOutputStream

0
			else { 
				imageStream = MainActivity.getNetworkController().getFileStream(MainActivity.getContext(), mMessage.getData());
			} 
 
			if (!mCancelled && imageStream != null) {
				PipedOutputStream out = new PipedOutputStream();
				PipedInputStream inputStream;
				try { 
					inputStream = new PipedInputStream(out);
 
					EncryptionController.runDecryptTask(mMessage.getOurVersion(), mMessage.getOtherUser(), mMessage.getTheirVersion(), mMessage.getIv(),
							new BufferedInputStream(imageStream), out);
 
					if (mCancelled) {
						inputStream.close();
						mMessage.setLoaded(true);
						mMessage.setLoading(false);
						mChatAdapter.checkLoaded();
						return; 
					}