可以扩展通过 allocateDirect 方法创建的 ByteBuffer 吗?

It is possible to expand a ByteBuffer created through the allocateDirect method?

有没有办法在创建堆外 ByteBuffer 后增加分配的内存?

A direct byte buffer may also be created by mapping a region of a file directly into memory. An implementation of the Java platform may optionally support the creation of direct byte buffers from native code via JNI. If an instance of one of these kinds of buffers refers to an inaccessible region of memory then an attempt to access that region will not change the buffer's content and will cause an unspecified exception to be thrown either at the time of the access or at some later time.

API 没有规定,但可能有一个 JVM 允许它通过 JNI。 我会说 NO.