Code example for PipedInputStream

0
 
			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; 
					} 
 
					byte[] bytes = Utils.inputStreamToBytes(inputStream);
					if (mCancelled) {
						mMessage.setLoaded(true);
						mMessage.setLoading(false);
						mChatAdapter.checkLoaded();
						return;