@ Override public ByteBuffer getBuffer ( ) { // If we are expected to read large message, we'll opt for zero- // copy, i.e. we'll ask caller to fill the data directly to the // message. Note that subsequent read(s) are non-blocking, thus // each single read reads at most SO_RCVBUF bytes at once not // depending on how large is the chunk returned from here. // As a consequence, large messages being received won't block // other engines running in the same I/O thread for excessive // amounts of time. if ( toRead >= bufsize ) { zeroCopy = true ; return readPos . duplicate ( ) ; } else { zeroCopy = false ; buf . clear ( ) ; return buf ; } }
Returns a buffer to be filled with binary data .