Code example for PipedInputStream

	protected InputStream getStreamFromOtherSource(String imageUri, Object extra) throws IOException {
		if (imageUri.toLowerCase(Locale.US).startsWith("thumb")) {
			String original = URLDecoder.decode(imageUri.substring("thumb://".length()), "UTF-8");
			final Bitmap bm = ThumbnailUtils.createVideoThumbnail(original, MediaStore.Video.Thumbnails.MINI_KIND);
			final PipedInputStream in = new PipedInputStream();
			if ( bm == null ){
				throw new IOException();
			new Thread() {
				PipedOutputStream out = new PipedOutputStream(in);
				public void run() { 
					bm.compress(Bitmap.CompressFormat.JPEG, 75, out);
					try { 
Connect your IDE to all the code out there  Get Codota for Java