private void copyAndResizeCodeBuffer ( ByteBuffer codeBuffer , int start , int length ) { // Check the internal code buffer is large enough or resize it, then copy in the new instructions. int max = start + length ; if ( this . codeBuffer . limit ( ) <= max ) { ByteBuffer newCodeBuffer = ByteBuffer . allocate ( max * 2 ) ; newCodeBuffer . put ( this . codeBuffer . array ( ) , 0 , this . codeBuffer . limit ( ) ) ; log . fine ( "Re-sized code buffer to " + ( max * 2 ) ) ; } codeBuffer . position ( start ) ; codeBuffer . get ( this . codeBuffer . array ( ) , start , length ) ; }
Copies code from the specified code buffer into the internal one resizing the internal code buffer if necessary to make enough room .