protected InputStream getStreamFromNetwork(String imageUri, Object extra) throws IOException {
		HttpURLConnection conn = createConnection(imageUri, extra);

		int redirectCount = 0;
		while (conn.getResponseCode() / 100 == 3 && redirectCount < MAX_REDIRECT_COUNT) {
			conn = createConnection(conn.getHeaderField("Location"), extra);
			redirectCount++;
		}

		InputStream imageStream;
		try {
			imageStream = conn.getInputStream();
		} catch (IOException e) {
			// Read all data to allow reuse connection (http://bit.ly/1ad35PY)
			IoUtils.readAndCloseStream(conn.getErrorStream());
			throw e;
		}
		if (!shouldBeProcessed(conn)) {
			IoUtils.closeSilently(imageStream);
			throw new IOException("Image request failed with response code " + conn.getResponseCode());
		}

		return new ContentLengthInputStream(new BufferedInputStream(imageStream, BUFFER_SIZE), conn.getContentLength());
	}
protected InputStream getStreamFromNetwork ( String imageUri , Object extra ) throws IOException { HttpURLConnection conn = createConnection ( imageUri , extra ) ; int redirectCount = 0 ; while ( conn . getResponseCode ( ) / 100 == 3 && redirectCount < MAX_REDIRECT_COUNT ) { conn = createConnection ( conn . getHeaderField ( "Location" ) , extra ) ; redirectCount ++ ; } InputStream imageStream ; try { imageStream = conn . getInputStream ( ) ; } catch ( IOException e ) { IoUtils . readAndCloseStream ( conn . getErrorStream ( ) ) ; throw e ; } if ( ! shouldBeProcessed ( conn ) ) { IoUtils . closeSilently ( imageStream ) ; throw new IOException ( "Image request failed with response code " + conn . getResponseCode ( ) ) ; } return new ContentLengthInputStream ( new BufferedInputStream ( imageStream , BUFFER_SIZE ) , conn . getContentLength ( ) ) ; }
Retrieves {@link InputStream} of image by URI (image is located in the network).

@param imageUri Image URI
@param extra    Auxiliary object which was passed to {@link DisplayImageOptions.Builder#extraForDownloader(Object)
DisplayImageOptions.extraForDownloader(Object)}; can be null
@return {@link InputStream} of image
@throws IOException if some I/O error occurs during network request or if no InputStream could be created for
URL.