How to read a request using CompletionHandlers and a ByteBuffer smaller than the request?
问题 I am using Java 7 and AsynchronousSocketChannel. I would like to read a request (e.g. HTTP POST ) but I'm struggling to come up with a nice solution to read the full request, if it's bigger than the size of the ByteBuffer I'm using. E.g. if the ByteBuffer is 4048 bytes and the HTTP POST contains an image that is larger than 4kB. Is there any nice recursive solution or loop for this? Here is my code for reading requests: public void readRequest(final AsynchronousSocketChannel ch) { final