You Are Here:

Community: Developer Discussion Boards

#1 Old 6310i problem - 2003-04-07, 11:02

Join Date: Apr 2003
Posts: 3
plamendr
Offline
Registered User
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 With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia