| Reply | « Previous Thread | Next Thread » |
|
Hi,
I use the "Nokia Developer's Suite for J2ME 1.1" to test my MIDlet, and I have this problem with the emulator of 6310i which is bundled. If I make a http connection and read until a negative int comes, the reading goes forever, most probably with the thread blocked at InputStream.read, waiting for next byte. //download thread HttpConnection con = null; InputStream is = null; try { con = (HttpConnection) Connector.open( statusStr); is = con.openInputStream(); int contentLength = (int) con.getLength(); //DEBUG System.out.println("Content length is " + contentLength); if (contentLength < 0) { ByteArrayOutputStream baos = new ByteArrayOutputStream(5120); int ch = 0; while ((ch = is.read()) >= 0) { baos.write(ch); } downloaded = baos.toByteArray(); downloadedCount = downloaded.length; } else { downloaded = new byte[contentLength]; downloadedCount = is.read(downloaded); } // DEBUG System.out.println( "Download finished..." + downloadedCount); On any phone I try and on the Sun's Wireless Toolkit everything is fine. I don't have the phone itself and I'm not sure if the problem is the same |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|