Monitor the progress of an input stream / httpclient.exectute
<p>I'm trying to get the progress of an Apache HTTP Client Execute method. Is it possible to either</p>

<ol>
<li>Get the mount of input stream that has been read by the execute method
or </li>
<li>Monitor the execute process using some internal method either by percent or amount of data sent?</li>
</ol>

<p>The code below sends an input stream to the server (in this case an image) which is then stored appropriately. Problem is with high resolution cameras and slow mobile operators its hard to tell if an upload is actually taking place. The code does work, but feedback is desired.</p>

<pre><code>public List writeBinary(String script, InputStream lInputStream) {
        Log.d(Global.TAG,"--&gt;writing to server...");

        HttpParams httpParameters = new BasicHttpParams();
        HttpConnectionParams.setConnectionTimeout(httpParameters, 5*1000);
        HttpConnectionParams.setSoTimeout(httpParameters, 60*1000);

        HttpClient httpclient = new DefaultHttpClient(httpParameters);
        HttpPost httppost = new HttpPost("http://xxx.xxx.xxx.xxx" + script);

        String responseText = null;
        List responseArray = new ArrayList();

        try {
            httppost.setEntity(new InputStreamEntity(lInputStream, -1));
            HttpResponse response = httpclient.execute(httppost);

            if (response.getStatusLine().getStatusCode() == 200){
                InputStream lInputStreamResponse = response.getEntity().getContent();
                DataInputStream lDataInputStream = new DataInputStream(lInputStreamResponse);
                BufferedReader lBufferReader = new BufferedReader(new InputStreamReader(lDataInputStream));

                while ((responseText = lBufferReader.readLine()) != null){
                    responseArray.add(responseText);
                }

                lInputStream.close();
            }

        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

        return responseArray;
    }
</code></pre>
