Thank you for visiting the BlackBerry Support Community Forums.
BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)
BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.
"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."
- Kevin Michaluk, Founder, CrackBerry.com
Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.
10-15-2008 05:37 PM
the read() method in inputStream class is blocking. I want to use available() method to provide an unblocked condition: ie. only call read() method when available() return a number greater than 0.
However, the method available() in InputStream class is not implemented and always return 0. it is useless. How to solve this problem?
10-15-2008 08:34 PM
Generally the easiest thing to do is launch your own loader thread that can block without consequence.
You can subclass stream and implement available if you like. I haven't looked but there may be some buffered
stream classes you can use, I usually end up writing my own because I want to instrument them.
10-15-2008 09:05 PM
Well, you need something to override it with. Presumably there are some internal or native buffers and maybe you could
get hacked system dependent code to access these but more realistically in java you have to
create your own buffer and report available on that.
I can't find a good example here but see if you can,
So far on the BB apps, it has made more sense to just buffer entire files and let the buffer worry about retry or messed up
connections rather than dribble pieces of data to the consumer. Unless you are doing some kind of streaming this may make
sense for you.