I have code in a worker thread that needs to efficiently read a constantly-growing input stream from a process.
The issue is that the present design uses a sleep() for a short period if there is no input presently available, and I'd like the attempt to read the input stream simply *block* so it magically awakes when more input is available. I fear this will mean a small hit on phone responsiveness. How does one alter code from this form to do such a thing? BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream())); do { String line; while ((line = bufferedReader.readLine()) != null) { // new input would be processed here } Thread.sleep(500); // TODO: make this go away } while (true); -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en