"In general, a Writer sends its output immediately to the underlying
character or byte stream. Unless prompt output is required, it is advisable
to wrap a BufferedWriter around any Writer whose write() operations may be
costly, such as FileWriters and OutputStreamWriters. For example, 

 PrintWriter out
   = new PrintWriter(new BufferedWriter(new FileWriter("foo.out")));
 will buffer the PrintWriter's output to the file. Without buffering, each
invocation of a print() method would cause characters to be converted into
bytes that would then be written immediately to the file, which can be very
inefficient."

That was a direct quote from the javadoc for BufferedWriter....what happened
to the old art of RTFM?

And also, you want to use StringReader not StringBufferInputStream... as it
is deprecated..Once again you would have found that out if have RTFM

Sashi

-----Original Message-----
From: Abhilash Nair [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 21, 2002 8:48 AM
To: JDJList
Subject: [jdjlist] RE: Java IO Question


Yes Scot. I meant quickest to execute...
I've used StringBufferInputStream to read the data
from a StringBuffer and a FileWriter to write it on to
a text file to be stored in the local drive. Will
substituting BufferedWriter in place of a FileWriter
help the performance? Thanks for your suggestion.

Regards,
Abhi

--- Scot Mcphee <[EMAIL PROTECTED]> wrote:
> When you say quickest, do you mean quickest to code
> or quickest to execute?
> If you want quickest to execute I would use a
> BufferedWriter. Actually I'd
> use a BufferedWriter anyway.
> 
> regs
> scot.
> 
> > -----Original Message-----
> > From: Abhilash Nair [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, 21 August 2002 03:50
> > To: JDJList
> > Subject: [jdjlist] Java IO Question
> >
> >
> > Hi All:
> >
> > Could anyone please suggest the fastest and most
> > efficient way to transfer data from a StringBuffer
> to
> > a text file in the local drive?
> >
> > Thanks in Advance
> > Abhi
> >
> > =====
> > You can reach me on:
> > Weekdays: (617)509-5312
> > Weekends and evenings: (781)321-2065
> > Pager: (781)553-8323
> > Thanks and Regards,
> > Nair Abhilash R
> > (Abhi)
> >
> > __________________________________________________
> > Do You Yahoo!?
> > HotJobs - Search Thousands of New Jobs
> > http://www.hotjobs.com
> >
> > To change your membership options, refer to:
> > http://www.sys-con.com/java/list.cfm
> >
> 
> 
> To change your membership options, refer to:
> http://www.sys-con.com/java/list.cfm


=====
You can reach me on:
Weekdays: (617)509-5312
Weekends and evenings: (781)321-2065
Pager: (781)553-8323
Thanks and Regards,
Nair Abhilash R
(Abhi)

__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm

To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm

Reply via email to