question: public ByteBuffer allocate ( int bodySize ) { bodySize = Math . min ( bodySize , maxPlaintextSize ) ; int padding = 0 ; if ( securityMode == MessageSecurityMode . SignAndEncrypt ) { int plaintextSizeExcludingPadding = bodySize + sequenceHeader + signatureSize ; padding = getMinimumPadding ( ) ; int modulo = ( padding + plaintextSizeExcludingPadding ) % cipherBlockSize ; if ( modulo != 0 ) padding += cipherBlockSize - modulo ; logger . trace ( "allocate: padding={}" , padding ) ; } int chunkSize = bodySize + messageHeaderSize + securityHeader + sequenceHeader + signatureSize + padding ; logger . trace ( "allocate: chunkSize={}" , chunkSize ) ; assert ( chunkSize <= maxChunkSize ) ; ByteBuffer result = ByteBuffer . allocate ( chunkSize ) ; result . order ( ByteOrder . LITTLE_ENDIAN ) ; result . position ( 4 ) ; result . putInt ( chunkSize ) ; if ( securityMode == MessageSecurityMode . SignAndEncrypt ) { writePadding ( messageHeaderSize + securityHeader + sequenceHeader + bodySize , padding , result ) ; } result . position ( messageHeaderSize + securityHeader + sequenceHeader ) ; result = result . slice ( ) ; result . order ( ByteOrder . LITTLE_ENDIAN ) ; result . limit ( bodySize ) ; return result ; }
target:  Allocate chunk for a message with a given body size.