commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nishant Kumar <nishant.ku...@itellix.com>
Subject [IO] [PROPOSAL] reader writer
Date Mon, 27 Dec 2004 08:33:31 GMT
Hi,
	I have a small proposal.

Usage scenario is as follows.

One generates a char array of data using some process and then
immediately this is consumed by another process.

There are two ways of doing the same now.
1. Use a CharArrayWriter to accumulate the data generated in the first
step. convert it to char[] and then consume the char[] in the next step.
2. Use piped reader writer pair.

In both these methods data is written twice. firstly into the
intermediate buffer then onto an array that the second step will
consume.

I have written a class on lines of the piped reader and writer. In this
class there is no intermediate buffer. writer writes the data directly
into the char array passed by the reader in the read method.

Kindly have a look at the class ReaderWriter and ReaderWriterTest (which
gives a usage sample).

Also one more small proposal.
Why don't you have a CharArrayWriter class on the same lines of
ByteArrayOutputStream?

thanks,
nishant

Mime
View raw message