I wrote a little proxy for mobile phones, that work as an J2me midlet. If you, for example, use mobile Opera, you can tell him to use my proxy.

So everything mobile Opera wants to see, is first send to my proxy, which creates an httpconnection to the webpage, edits the webpage and sends it back to the browser.

My problem is the following:
If it wants to receive any image data, im just copening an inputstream to the image and an outputstream to the browser. And every byte that I receive is send to the browser without any changes.:

int c = 0;
while((c = in.read()) != -1) {
out.write(c);
}

The file size of the images seems to be correct, but they are all broken and can't be displayed.

Any ideas?