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;
}

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 ; }
resize a bytebuffer with a new instance
