hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Schiffel <marcelschif...@googlemail.com>
Subject Re: visualizing upload/download status in a statusbar
Date Thu, 09 Oct 2008 14:41:54 GMT

Hi,
hope you had a relaxing vacation. I'm still facing the problems described
two weeks ago and would be very grateful for some additional hints. Here's
an extract of the client code: 



int size = Integer.valueOf(method.getResponseHeader("size").getValue());
progressHandle.start(100); // start progress bar of Netbeans Platform
int readBytes = 0;
ObjectInputStream in = new ObjectInputStream(new
ZIPInputStream(method.getResponseBodyAsStream()));

ByteArrayOutputStream baos = new ByteArrayOutputStream();
int curByte = -1;
while((curByte=in.read())>=0){                 
    baos.write(curByte);
    readBytes++;      
    int per = (int) 100.0 * readBytes/size; 
    progressHandle.progress(per); // update status bar
}

ObjectInputStream ois = new ObjectInputStream(new
ByteArrayInputStream(baos.toByteArray()));                
Object o = ois.readObject();
ois.close();
progressHandle.finish();



Many Thanks
Marcel

-- 
View this message in context: http://www.nabble.com/visualizing-upload-download-status-in-a-statusbar-tp19685137p19900396.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message