RFC: Character set converters...
Per Bothner
per@bothner.com
Fri Aug 13 20:39:00 GMT 2004
Bryce McKinlay wrote:
> How would you get data into the converter without either an extra layer
> of copying, or creating a new CharBuffer instance each time (via the
> wrap() method)? Seems to me you'd have to do one of these things for
> every write() call.
Can you not allocate the CharBuffer/ByteBuffers in the
OutputStreamWriter and InputStreamReader classes?
We could define gnu.java.io.BufferedOutputStream and
gnu.java.io.BufferedInputStream classes, which would be
functionally equivalent to java.io.BufferedOutputStream
and java.io.BufferedInputStream, except that they use
direct byte buffers. Hence they don't export the old
protected fields, but instead export a ByteBuffer.
Internal code would use these new classes. This
includes OutputStreamWriter and InputStreamReader.
The OutputStreamWriter/InputStreamWriter would
allocate a CharBuffer.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
More information about the Java
mailing list