示例#1
0
 @Override
 public UnsafeArrayData copy() {
   UnsafeArrayData arrayCopy = new UnsafeArrayData();
   final byte[] arrayDataCopy = new byte[sizeInBytes];
   PlatformDependent.copyMemory(
       baseObject, baseOffset, arrayDataCopy, PlatformDependent.BYTE_ARRAY_OFFSET, sizeInBytes);
   arrayCopy.pointTo(arrayDataCopy, PlatformDependent.BYTE_ARRAY_OFFSET, numElements, sizeInBytes);
   return arrayCopy;
 }
示例#2
0
 @Override
 public UnsafeArrayData getArray(int ordinal) {
   if (isNullAt(ordinal)) {
     return null;
   } else {
     final long offsetAndSize = getLong(ordinal);
     final int offset = (int) (offsetAndSize >> 32);
     final int size = (int) (offsetAndSize & ((1L << 32) - 1));
     final UnsafeArrayData array = new UnsafeArrayData();
     array.pointTo(baseObject, baseOffset + offset, size);
     return array;
   }
 }