Try:
ByteArrayOutputStream bout = new ByteArrayOutputStream();
StringReader sr = new StringReader(strString);
int val=0;
byte[] bytes = new byte[32*1024] //32K byte array
while ((val=sr.read(bytes))!= -1) {
bout.write(bytes,0,val);
}
But, I would be weary of mixing readers with outputstreams. I would make
sure you use a Reader with a Writer or and InputStream with an OutputStream.
Mainly due to conversion protocols but can cause some probs...
HTH
Steve
"D" <no***@nowhere.COM> wrote in message
news:3f**********************@news.dial.pipex.com. ..
Hi,
I have some old code that uses the deprecated copy command as :
ByteArrayOutputStream bout = new ByteArrayOutputStream();
StringReader sr = new StringReader(strString);
copy(sr,bout);
how could I achieve the same result without the now redundant copy
command?
Thanks
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.530 / Virus Database: 325 - Release Date: 22/10/2003