What to do about write(CharBuffer)?

Gili cowwoc at bbs.darktech.org
Sun Jun 28 15:13:27 PDT 2009


Hi,

As discussed before, I've got a class that reads/writes CharBuffers on top
of an existing AsynchronousByteChannel. I'd like your opinion on the
following problem.

When a user writes out a CharBuffer, I use CharsetEncoder.encode() to
convert it to bytes. The value of CharsetEncoder.encode()'s "endOfInput"
argument is used to trigger malformed-character errors. It's not clear how
I'm supposed to know whether I've reach the end of input...

So, does that imply I should change the method signature from
write(CharBuffer) to write(CharBuffer, endOfInput)?

Thanks,
Gili
-- 
View this message in context: http://n2.nabble.com/What-to-do-about-write%28CharBuffer%29--tp3171370p3171370.html
Sent from the nio-discuss mailing list archive at Nabble.com.




More information about the nio-discuss mailing list