Code example for PipedInputStream

0
	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 { 
						out.close();