AsynchronousCharChannel
Gili
cowwoc at bbs.darktech.org
Thu Jul 2 08:44:23 PDT 2009
Alan Bateman (via Nabble) wrote:
> I haven't had a chance to look at this in any detail but I wonder if you
> really need write(... boolean endOfInput)? That is, do you really need
> the equivalent of a half-close (as in TCP) or isn't close sufficient?
Good point. I'll update this in the next release.
I'm also looking for a way to use a more generic argument for
readLine(). Right now I reference StringBuilder explicitly because:
- Passing in CharBuffer (which is Appendable) is questionable because
you're likely to run into BufferedOverflowException.
- I need to know how many characters were written into the buffer. I can
either butcher CharSequenceWriter to expose this information or use
something like <T extends Appendable & CharSequence> but the latter
wasn't working so cleanly because CharBuffer.length() ==
CharBuffer.remaining(). Meaning it gets smaller as more data is written
to it, whereas StringBuilder.length() gets longer as more data is
written to it, so it makes it impossible to use CharSequence.length()
consistently to find out how many characters were written.
Gili
--
View this message in context: http://n2.nabble.com/AsynchronousCharChannel-tp3156277p3195813.html
Sent from the nio-discuss mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-discuss/attachments/20090702/6c46e1a4/attachment.html
More information about the nio-discuss
mailing list