Difference between java.io.PrintWriter and java.io.BufferedWriter?

PrintWriter gives more methods (println), but the most important (and worrying) difference to be aware of is that it swallows exceptions. You can call checkError later on to see whether any errors have occurred, but typically you’d use PrintWriter for things like writing to the console – or in “quick ‘n dirty” apps where you … Read more

Android Reading from an Input stream efficiently

The problem in your code is that it’s creating lots of heavy String objects, copying their contents and performing operations on them. Instead, you should use StringBuilder to avoid creating new String objects on each append and to avoid copying the char arrays. The implementation for your case would be something like this: BufferedReader r … Read more