response truncated after switch from ServletOutputStream to OutputStreamWriter

Posted on 2006-04-27
Medium Priority
Last Modified: 2011-10-03

I had a servlet that was writing html output using;

ServletOutputStream out = response.getOutputStream();
out.println(" ... ");

I changed this to:
ServletOutputStream out = response.getOutputStream();
OutputStreamWriter outputWriter = new OutputStreamWriter(out);
outputWriter.write(" ... ");

Now when I browse to the Servlet I get _most_ of the HTML printed to my browser, but the output seems to stop after a certain number of characters.  Is there something wrong with the way I'm using OutputStreamWriter; odes it have a finite buffer size?

Question by:blackfrancis75
1 Comment
LVL 92

Accepted Solution

objects earned 2000 total points
ID: 16559339
try doing a flush() after you've written all the output

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses
Course of the Month9 days, 7 hours left to enroll

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question