I was switching a project from blocking IO to non-blocking IO.
For the most part, Java wants you to use ByteBuffer for all the read/write operations.
I don’t know if it is just me but ByteBuffer does not work like I would expect it to.
I have a ByteBuffer with 50 bytes of data and capacity of 100, I issue the write. The write only sends the first 30 bytes. I would expect I could add another 70 bytes of data into the ByteBuffer. However, that does not seem to be the case. It’s like the designers wanted you to empty out the buffer before you added any more to it.
Like I said, maybe it’s just me but seemed counter-intuitive.