This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH]: DatagramChannel + Misc. Channel Fixes


Hi Michael,

>> Here you go....
>
>Now I go ...
>
>> -        int len = dst.remaining();
>> +        int len = dst.capacity() - dst.position();
>
>Why is this needed ? This means that we write probably more data into
>the buffer then is suitable. I think we have to honor limit(). This is
>automatically done by using remaining().

>Can you write a little example proving I'm wrong ? (not that big NetTest
>suite.

dst.remaining() means that there are dst.remaining() bytes in the buffer
and we want to do something with them. That isn't the case here. Here,
we want to put data into the buffer and dst.capacity() - dst.position() is
the number of bytes we're allowed to store into the buffer.

-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]