Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Confused with PrintWriter, OutputStream and OutputStreamWriter.

Reply
Thread Tools

Confused with PrintWriter, OutputStream and OutputStreamWriter.

 
 
CamT
Guest
Posts: n/a
 
      03-16-2005
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
 
Reply With Quote
 
 
 
 
Oscar kind
Guest
Posts: n/a
 
      03-16-2005
CamT <(E-Mail Removed)> wrote:
> 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).


--
Oscar Kind http://home.hccnet.nl/okind/
Software Developer for contact information, see website

PGP Key fingerprint: 91F3 6C72 F465 5E98 C246 61D9 2C32 8E24 097B B4E2
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP's output buffer and ASP.NET's Response.OutputStream kellygreer1 ASP .Net 3 12-12-2007 10:41 PM
problem with rendering page using 'Response.Redirect' and 'Response.OutputStream' André ASP .Net 3 12-01-2006 07:20 AM
OutputStream from a URLConnection produces an OutOfMemory OutputStream from a URLConnection produces an OutOfMemory WinstonSmith_101@hotmail.com Java 2 10-25-2006 04:45 PM
OutputStream and servlet bigbinc Java 0 02-17-2004 05:24 PM
extended ascii delimiters when when writing to outputstream brrrdog ASP .Net 0 07-09-2003 04:58 AM



Advertisments