当前位置: 首页>>代码示例>>Java>>正文


Java GridUnsafe.copyMemory方法代码示例

本文整理汇总了Java中org.apache.ignite.internal.util.GridUnsafe.copyMemory方法的典型用法代码示例。如果您正苦于以下问题:Java GridUnsafe.copyMemory方法的具体用法?Java GridUnsafe.copyMemory怎么用?Java GridUnsafe.copyMemory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ignite.internal.util.GridUnsafe的用法示例。


在下文中一共展示了GridUnsafe.copyMemory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeDoubleArray

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void writeDoubleArray(double[] arr) throws IOException {
    writeInt(arr.length);

    int bytesToCp = arr.length << 3;

    requestFreeSize(bytesToCp);

    if (BIG_ENDIAN) {
        long off = BYTE_ARR_OFF + this.off;

        for (double val : arr) {
            GridUnsafe.putDoubleLE(bytes, off, val);

            off += 8;
        }
    }
    else
        GridUnsafe.copyMemory(arr, DOUBLE_ARR_OFF, bytes, BYTE_ARR_OFF + off, bytesToCp);

    onWrite(bytesToCp);
}
 
开发者ID:apache,项目名称:ignite,代码行数:23,代码来源:GridUnsafeDataOutput.java

示例2: writeCharArray

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void writeCharArray(char[] arr) throws IOException {
    writeInt(arr.length);

    int bytesToCp = arr.length << 1;

    requestFreeSize(bytesToCp);

    if (BIG_ENDIAN) {
        long off = BYTE_ARR_OFF + this.off;

        for (char val : arr) {
            GridUnsafe.putCharLE(bytes, off, val);

            off += 2;
        }
    }
    else
        GridUnsafe.copyMemory(arr, CHAR_ARR_OFF, bytes, BYTE_ARR_OFF + off, bytesToCp);

    onWrite(bytesToCp);
}
 
开发者ID:apache,项目名称:ignite,代码行数:23,代码来源:GridUnsafeDataOutput.java

示例3: writeLongArray

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void writeLongArray(long[] arr) throws IOException {
    writeInt(arr.length);

    int bytesToCp = arr.length << 3;

    requestFreeSize(bytesToCp);

    if (BIG_ENDIAN) {
        long off = BYTE_ARR_OFF + this.off;

        for (long val : arr) {
            GridUnsafe.putLongLE(bytes, off, val);

            off += 8;
        }
    }
    else
        GridUnsafe.copyMemory(arr, LONG_ARR_OFF, bytes, BYTE_ARR_OFF + off, bytesToCp);

    onWrite(bytesToCp);
}
 
开发者ID:apache,项目名称:ignite,代码行数:23,代码来源:GridUnsafeDataOutput.java

示例4: writeFloatArray

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void writeFloatArray(float[] arr) throws IOException {
    writeInt(arr.length);

    int bytesToCp = arr.length << 2;

    requestFreeSize(bytesToCp);

    if (BIG_ENDIAN) {
        long off = BYTE_ARR_OFF + this.off;

        for (float val : arr) {
            GridUnsafe.putFloatLE(bytes, off, val);

            off += 4;
        }
    }
    else
        GridUnsafe.copyMemory(arr, FLOAT_ARR_OFF, bytes, BYTE_ARR_OFF + off, bytesToCp);

    onWrite(bytesToCp);
}
 
开发者ID:apache,项目名称:ignite,代码行数:23,代码来源:GridUnsafeDataOutput.java

示例5: writeShortArray

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void writeShortArray(short[] arr) throws IOException {
    writeInt(arr.length);

    int bytesToCp = arr.length << 1;

    requestFreeSize(bytesToCp);

    if (BIG_ENDIAN) {
        long off = BYTE_ARR_OFF + this.off;

        for (short val : arr) {
            GridUnsafe.putShortLE(bytes, off, val);

            off += 2;
        }
    }
    else
        GridUnsafe.copyMemory(arr, SHORT_ARR_OFF, bytes, BYTE_ARR_OFF + off, bytesToCp);

    onWrite(bytesToCp);
}
 
开发者ID:apache,项目名称:ignite,代码行数:23,代码来源:GridUnsafeDataOutput.java

示例6: writeIntArray

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void writeIntArray(int[] arr) throws IOException {
    writeInt(arr.length);

    int bytesToCp = arr.length << 2;

    requestFreeSize(bytesToCp);

    if (BIG_ENDIAN) {
        long off = BYTE_ARR_OFF + this.off;

        for (int val : arr) {
            GridUnsafe.putIntLE(bytes, off, val);

            off += 4;
        }
    }
    else
        GridUnsafe.copyMemory(arr, INT_ARR_OFF, bytes, BYTE_ARR_OFF + off, bytesToCp);

    onWrite(bytesToCp);
}
 
开发者ID:apache,项目名称:ignite,代码行数:23,代码来源:GridUnsafeDataOutput.java

示例7: readShortArray

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public short[] readShortArray() throws IOException {
    int arrSize = readInt();

    int bytesToCp = arrSize << 1;

    fromStream(bytesToCp);

    short[] arr = new short[arrSize];

    long off = BYTE_ARR_OFF + offset(bytesToCp);

    if (BIG_ENDIAN) {
        for (int i = 0; i < arr.length; i++) {
            arr[i] = GridUnsafe.getShortLE(buf, off);

            off += 2;
        }
    }
    else
        GridUnsafe.copyMemory(buf, off, arr, SHORT_ARR_OFF, bytesToCp);

    return arr;
}
 
开发者ID:apache,项目名称:ignite,代码行数:25,代码来源:GridUnsafeDataInput.java

示例8: readIntArray

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public int[] readIntArray() throws IOException {
    int arrSize = readInt();

    int bytesToCp = arrSize << 2;

    fromStream(bytesToCp);

    int[] arr = new int[arrSize];

    long off = BYTE_ARR_OFF + offset(bytesToCp);

    if (BIG_ENDIAN) {
        for (int i = 0; i < arr.length; i++) {
            arr[i] = GridUnsafe.getIntLE(buf, off);

            off += 4;
        }
    }
    else
        GridUnsafe.copyMemory(buf, off, arr, INT_ARR_OFF, bytesToCp);

    return arr;
}
 
开发者ID:apache,项目名称:ignite,代码行数:25,代码来源:GridUnsafeDataInput.java

示例9: readDoubleArray

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public double[] readDoubleArray() throws IOException {
    int arrSize = readInt();

    int bytesToCp = arrSize << 3;

    fromStream(bytesToCp);

    double[] arr = new double[arrSize];

    long off = BYTE_ARR_OFF + offset(bytesToCp);

    if (BIG_ENDIAN) {
        for (int i = 0; i < arr.length; i++) {
            arr[i] = GridUnsafe.getDoubleLE(buf, off);

            off += 8;
        }
    }
    else
        GridUnsafe.copyMemory(buf, off, arr, DOUBLE_ARR_OFF, bytesToCp);

    return arr;
}
 
开发者ID:apache,项目名称:ignite,代码行数:25,代码来源:GridUnsafeDataInput.java

示例10: readCharArray

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public char[] readCharArray() throws IOException {
    int arrSize = readInt();

    int bytesToCp = arrSize << 1;

    fromStream(bytesToCp);

    char[] arr = new char[arrSize];

    long off = BYTE_ARR_OFF + offset(bytesToCp);

    if (BIG_ENDIAN) {
        for (int i = 0; i < arr.length; i++) {
            arr[i] = GridUnsafe.getCharLE(buf, off);

            off += 2;
        }
    }
    else
        GridUnsafe.copyMemory(buf, off, arr, CHAR_ARR_OFF, bytesToCp);

    return arr;
}
 
开发者ID:apache,项目名称:ignite,代码行数:25,代码来源:GridUnsafeDataInput.java

示例11: readLongArray

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public long[] readLongArray() throws IOException {
    int arrSize = readInt();

    int bytesToCp = arrSize << 3;

    fromStream(bytesToCp);

    long[] arr = new long[arrSize];

    long off = BYTE_ARR_OFF + offset(bytesToCp);

    if (BIG_ENDIAN) {
        for (int i = 0; i < arr.length; i++) {
            arr[i] = GridUnsafe.getLongLE(buf, off);

            off += 8;
        }
    }
    else
        GridUnsafe.copyMemory(buf, off, arr, LONG_ARR_OFF, bytesToCp);

    return arr;
}
 
开发者ID:apache,项目名称:ignite,代码行数:25,代码来源:GridUnsafeDataInput.java

示例12: readFloatArray

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public float[] readFloatArray() throws IOException {
    int arrSize = readInt();

    int bytesToCp = arrSize << 2;

    fromStream(bytesToCp);

    float[] arr = new float[arrSize];

    long off = BYTE_ARR_OFF + offset(bytesToCp);

    if (BIG_ENDIAN) {
        for (int i = 0; i < arr.length; i++) {
            arr[i] = GridUnsafe.getFloatLE(buf, off);

            off += 4;
        }
    }
    else
        GridUnsafe.copyMemory(buf, off, arr, FLOAT_ARR_OFF, bytesToCp);

    return arr;
}
 
开发者ID:apache,项目名称:ignite,代码行数:25,代码来源:GridUnsafeDataInput.java

示例13: copyMemory

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
 * @param src Source.
 * @param srcOff Source offset in bytes.
 * @param dst Destination.
 * @param dstOff Destination offset in bytes.
 * @param cnt Bytes count to copy.
 */
public static void copyMemory(ByteBuffer src, long srcOff, ByteBuffer dst, long dstOff, long cnt) {
    byte[] srcArr = src.hasArray() ? src.array() : null;
    byte[] dstArr = dst.hasArray() ? dst.array() : null;
    long srcArrOff = src.hasArray() ? src.arrayOffset() + GridUnsafe.BYTE_ARR_OFF : 0;
    long dstArrOff = dst.hasArray() ? dst.arrayOffset() + GridUnsafe.BYTE_ARR_OFF : 0;

    long srcPtr = src.isDirect() ? GridUnsafe.bufferAddress(src) : 0;
    long dstPtr = dst.isDirect() ? GridUnsafe.bufferAddress(dst) : 0;

    GridUnsafe.copyMemory(srcArr, srcPtr + srcArrOff + srcOff, dstArr, dstPtr + dstArrOff + dstOff, cnt);
}
 
开发者ID:apache,项目名称:ignite,代码行数:19,代码来源:PageHandler.java

示例14: PageSnapshot

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
 * @param fullPageId Full page ID.
 * @param ptr Pointer to copy from.
 * @param pageSize Page size.
 */
public PageSnapshot(FullPageId fullPageId, long ptr, int pageSize) {
    this.fullPageId = fullPageId;

    pageData = new byte[pageSize];

    GridUnsafe.copyMemory(null, ptr, pageData, GridUnsafe.BYTE_ARR_OFF, pageSize);
}
 
开发者ID:apache,项目名称:ignite,代码行数:13,代码来源:PageSnapshot.java

示例15: readCharArray

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
 * @param arr Array.
 * @param off Offset.
 * @return Value.
 */
public static char[] readCharArray(byte[] arr, int off, int len) {
    char[] arr0 = new char[len];

    GridUnsafe.copyMemory(arr, GridUnsafe.BYTE_ARR_OFF + 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;
}
 
开发者ID:apache,项目名称:ignite,代码行数:18,代码来源:BinaryPrimitives.java


注:本文中的org.apache.ignite.internal.util.GridUnsafe.copyMemory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。