I have 1 MB file, which I try to download by parts over HTTP (1kb chunk at a time), so that I can display progress information and users can see how download is progressing.

Problem is that it seems that my phone first downloads the whole file into its memory and then spits 1kb chunks on me. This posts http://discussion.forum.nokia.com/fo...threadid=58017 by Graham Hughes suggests it could be caused by network operator's gateway (T-Mobile CZ).

Is there any way around it ? (except creating service on server that would cut file for me and would give me one part at a time. This solution would lead to much longer download time as HTTP connection would have to be opened for every chunk)


My code is:
HttpConnection c = (HttpConnection) Connector.open(getURL);
DataInputStream dis = c.openDataInputStream();
int updateLength = (int)c.getLength(); //  >>>>>>>>>>>>>> it seems it waits here until all data is downloaded

int block = 1024; // read data in those blocks
byte[] buffer = new byte[block];
int i=0;
int steps = ((updateLength % block) == 0) ? updateLength/block : updateLength/block + 1; // in how many chunks we read the file

for (int counter = updateLength;counter>0;counter-=block){
    bytesToRead = (counter>block?block:counter);
    progressBar.setValue(100 * i / steps); // <0..100>

if (dis != null) {
if (c != null) {