PrintWriter And ServletOutputStream API Doubt
posted 9 years ago
You usually use a PrintWriter to output text base documents, so println makes sense, whereas write does not. On the contrary, you usually use ServletOutputStream to output binary data where the carriage return does not make much sense. There are times when you'd like to mix both text and binary data (mulitpart response), where you can use ServletOutputStream#println. The authors want to focus on what we usually do, and on what is asked at the exam For the moment, just remember that you'll use PrintWriter to output text, and ServletOutputStream to output binary.