Confused with PrintWriter, OutputStream and OutputStreamWriter.

C

CamT

Hello

Rather confused with PrintWriter, OutputStream and OutputStreamWriter.

Not sure how to pass osw to pw.

PrintWriter pw=getAgentOutput();
RichTextItem body = (RichTextItem) docRT.getFirstItem("RTItem");
OutputStreamWriter osw = new OutputStreamWriter( new
RichTextOutputStream(body, true, true) );

Want print the contents of osw rich is a RichText to pw so as to do
println.

Or is there a better way to parse the richtext?

Many thanks
 
O

Oscar kind

CamT said:
Rather confused with PrintWriter, OutputStream and OutputStreamWriter.

Not sure how to pass osw to pw.

PrintWriter pw=getAgentOutput();
RichTextItem body = (RichTextItem) docRT.getFirstItem("RTItem");
OutputStreamWriter osw = new OutputStreamWriter( new
RichTextOutputStream(body, true, true) );

Want print the contents of osw rich is a RichText to pw so as to do
println.

Or is there a better way to parse the richtext?

It seems that you want the RichTextItem refered to by "body" to be written
to the PrintWriter refered to by "pw". If this is correct, read on.

To receive a stream of data representing the RichTextItem, you need a
RichTextInputStream (I'm assuming it exists). Then, read the contents of
that stream through an InputStreamReader to get characters.

Then, you can write the characters you receive from the InputStreamReader
into the PrintWriter (or any other Writer for that matter).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top