question: public static ByteBuffer resizeByteBuffer ( ByteBuffer buf , long size ) { ByteBuffer ret = ByteBuffer . allocateDirect ( ( int ) size ) ; if ( ret != null ) { if ( null != buf ) { ret . put ( buf ) ; ret . flip ( ) ; } } return ret ; }
target:  resize a bytebuffer with a new instance