本文整理汇总了Java中org.apache.ignite.internal.util.GridUnsafe.copyOffheapHeap方法的典型用法代码示例。如果您正苦于以下问题:Java GridUnsafe.copyOffheapHeap方法的具体用法?Java GridUnsafe.copyOffheapHeap怎么用?Java GridUnsafe.copyOffheapHeap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.internal.util.GridUnsafe
的用法示例。
在下文中一共展示了GridUnsafe.copyOffheapHeap方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: arrayCopy
import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public byte[] arrayCopy() {
if (dataCopy == null) {
dataCopy = new byte[len];
GridUnsafe.copyOffheapHeap(data, dataCopy, GridUnsafe.BYTE_ARR_OFF, dataCopy.length);
}
return dataCopy;
}
示例2: copyAndShift
import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
* Copy required amount of data and shift position.
*
* @param target Target to copy data to.
* @param off Offset.
* @param cnt Count.
*/
private void copyAndShift(Object target, long off, int cnt) {
ensureEnoughData(cnt);
GridUnsafe.copyOffheapHeap(data + pos, target, off, cnt);
shift(cnt);
}
示例3: readByteArray
import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
* @param ptr Pointer.
* @param off Offset.
* @return Value.
*/
public static byte[] readByteArray(long ptr, int off, int len) {
byte[] arr0 = new byte[len];
GridUnsafe.copyOffheapHeap(ptr + off, arr0, GridUnsafe.BYTE_ARR_OFF, len);
return arr0;
}
示例4: readCharArray
import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
* @param ptr Pointer.
* @param off Offset.
* @return Value.
*/
public static char[] readCharArray(long ptr, int off, int len) {
char[] arr0 = new char[len];
GridUnsafe.copyOffheapHeap(ptr + off, arr0, GridUnsafe.CHAR_ARR_OFF, len << 1);
if (BIG_ENDIAN) {
for (int i = 0; i < len; i++)
arr0[i] = Character.reverseBytes(arr0[i]);
}
return arr0;
}
示例5: arrayCopy
import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public byte[] arrayCopy() {
byte[] res = new byte[pos];
GridUnsafe.copyOffheapHeap(ptr, res, GridUnsafe.BYTE_ARR_OFF, pos);
return res;
}
示例6: arrayCopy
import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public byte[] arrayCopy() {
byte[] res = new byte[len];
GridUnsafe.copyOffheapHeap(ptr, res, GridUnsafe.BYTE_ARR_OFF, res.length);
return res;
}
示例7: copyAndShift
import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected void copyAndShift(Object target, long off, int len) {
GridUnsafe.copyOffheapHeap(ptr + pos, target, off, len);
shift(len);
}
示例8: readBytes
import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
* @param ptr Pointer.
* @param arr Array.
* @return The same array as passed in one.
*/
public byte[] readBytes(long ptr, byte[] arr) {
GridUnsafe.copyOffheapHeap(ptr, arr, GridUnsafe.BYTE_ARR_OFF, arr.length);
return arr;
}
示例9: add
import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
* @param marker Marker.
* @param ptr Pointer.
* @param size Size.
*/
private void add(byte marker, long ptr, int size) {
buf[off++] = marker;
GridUnsafe.putInt(buf, GridUnsafe.BYTE_ARR_OFF + off, size);
off += 4;
GridUnsafe.copyOffheapHeap(ptr, buf, GridUnsafe.BYTE_ARR_OFF + off, size);
off += size;
}