private void readPayloadFromBuffer ( final ByteBuffer buffer ) throws IOException { int toRead = payload . length - payloadOffset ; int available = buffer . remaining ( ) ; toRead = Math . min ( toRead , available ) ; getLogger ( ) . debug ( "Reading %d payload bytes" , toRead ) ; buffer . get ( payload , payloadOffset , toRead ) ; payloadOffset += toRead ; if ( payloadOffset == payload . length ) { finishedPayload ( payload ) ; } }
Read the payload from the buffer .