* @param resource a memory resource to wrap
* @return the new ByteBuffer
*/
public static ByteBuffer wrap(MemoryResource resource) {
final Object owner = resource.getOwner();
final Pointer address = new MemoryRawData(resource);
final int size = resource.getSize().toInt();
final ByteBuffer result = new DirectByteBufferImpl.ReadWrite(owner, address, size, size, 0);
result.mark();
return result;
}