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


Java GridUnsafe.BYTE_ARR_OFF属性代码示例

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


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

示例1: copyMemory

/**
 * @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,代码行数:18,代码来源:PageHandler.java

示例2: serializeCacheSizes

/**
 * @param cacheSizes Cache sizes: cache Id in shared group mapped to its size. Not null.
 * @return Serialized cache sizes or 0-byte length array if map was empty.
 */
public byte[] serializeCacheSizes(Map<Integer, Long> cacheSizes) {
    byte[] data = new byte[cacheSizes.size() * ITEM_SIZE];
    long off = GridUnsafe.BYTE_ARR_OFF;

    for (Map.Entry<Integer, Long> entry : cacheSizes.entrySet()) {
        GridUnsafe.putInt(data, off, entry.getKey()); off += CACHE_ID_SIZE;
        GridUnsafe.putLong(data, off, entry.getValue()); off += CACHE_SIZE_SIZE;
    }

    return data;
}
 
开发者ID:apache,项目名称:ignite,代码行数:15,代码来源:PagePartitionCountersIO.java

示例3: unsafeWriteLong

/** {@inheritDoc} */
@Override public void unsafeWriteLong(long val) {
    long off = GridUnsafe.BYTE_ARR_OFF + pos;

    if (BIG_ENDIAN)
        GridUnsafe.putLongLE(data, off, val);
    else
        GridUnsafe.putLong(data, off, val);

    shift(8);
}
 
开发者ID:apache,项目名称:ignite,代码行数:11,代码来源:BinaryHeapOutputStream.java

示例4: writeChar

/**
 * @param arr Array.
 * @param off Offset.
 * @param val Value.
 */
public static void writeChar(byte[] arr, int off, char val) {
    long pos = GridUnsafe.BYTE_ARR_OFF + off;

    if (BIG_ENDIAN)
        GridUnsafe.putCharLE(arr, pos, val);
    else
        GridUnsafe.putChar(arr, pos, val);
}
 
开发者ID:apache,项目名称:ignite,代码行数:13,代码来源:BinaryPrimitives.java

示例5: writeInt

/**
 * @param arr Array.
 * @param off Offset.
 * @param val Value.
 */
public static void writeInt(byte[] arr, int off, int val) {
    long pos = GridUnsafe.BYTE_ARR_OFF + off;

    if (BIG_ENDIAN)
        GridUnsafe.putIntLE(arr, pos, val);
    else
        GridUnsafe.putInt(arr, pos, val);
}
 
开发者ID:apache,项目名称:ignite,代码行数:13,代码来源:BinaryPrimitives.java

示例6: writeLong

/**
 * @param arr Array.
 * @param off Offset.
 * @param val Value.
 */
public static void writeLong(byte[] arr, int off, long val) {
    long pos = GridUnsafe.BYTE_ARR_OFF + off;

    if (BIG_ENDIAN)
        GridUnsafe.putLongLE(arr, pos, val);
    else
        GridUnsafe.putLong(arr, pos, val);
}
 
开发者ID:apache,项目名称:ignite,代码行数:13,代码来源:BinaryPrimitives.java

示例7: unsafeWriteChar

/** {@inheritDoc} */
@Override public void unsafeWriteChar(char val) {
    long off = GridUnsafe.BYTE_ARR_OFF + pos;

    if (BIG_ENDIAN)
        GridUnsafe.putCharLE(data, off, val);
    else
        GridUnsafe.putChar(data, off, val);

    shift(2);
}
 
开发者ID:apache,项目名称:ignite,代码行数:11,代码来源:BinaryHeapOutputStream.java

示例8: writeShortFast

/** {@inheritDoc} */
@Override protected void writeShortFast(short val) {
    long off = GridUnsafe.BYTE_ARR_OFF + pos;

    if (BIG_ENDIAN)
        GridUnsafe.putShortLE(data, off, val);
    else
        GridUnsafe.putShort(data, off, val);
}
 
开发者ID:apache,项目名称:ignite,代码行数:9,代码来源:BinaryHeapOutputStream.java

示例9: unsafeWriteInt

/** {@inheritDoc} */
@Override public void unsafeWriteInt(int val) {
    long off = GridUnsafe.BYTE_ARR_OFF + pos;

    if (BIG_ENDIAN)
        GridUnsafe.putIntLE(data, off, val);
    else
        GridUnsafe.putInt(data, off, val);

    shift(4);
}
 
开发者ID:apache,项目名称:ignite,代码行数:11,代码来源:BinaryHeapOutputStream.java

示例10: writeIntFast

/** {@inheritDoc} */
@Override protected void writeIntFast(int val) {
    long off = GridUnsafe.BYTE_ARR_OFF + pos;

    if (BIG_ENDIAN)
        GridUnsafe.putIntLE(data, off, val);
    else
        GridUnsafe.putInt(data, off, val);
}
 
开发者ID:apache,项目名称:ignite,代码行数:9,代码来源:BinaryHeapOutputStream.java

示例11: unsafeWriteShort

/** {@inheritDoc} */
@Override public void unsafeWriteShort(short val) {
    long off = GridUnsafe.BYTE_ARR_OFF + pos;

    if (BIG_ENDIAN)
        GridUnsafe.putShortLE(data, off, val);
    else
        GridUnsafe.putShort(data, off, val);

    shift(2);
}
 
开发者ID:apache,项目名称:ignite,代码行数:11,代码来源:BinaryHeapOutputStream.java

示例12: readShort

/**
 * @param arr Array.
 * @param off Offset.
 * @return Value.
 */
public static short readShort(byte[] arr, int off) {
    long pos = GridUnsafe.BYTE_ARR_OFF + off;

    return BIG_ENDIAN ? GridUnsafe.getShortLE(arr, pos) : GridUnsafe.getShort(arr, pos);
}
 
开发者ID:apache,项目名称:ignite,代码行数:10,代码来源:BinaryPrimitives.java

示例13: readChar

/**
 * @param arr Array.
 * @param off Offset.
 * @return Value.
 */
public static char readChar(byte[] arr, int off) {
    long pos = GridUnsafe.BYTE_ARR_OFF + off;

    return BIG_ENDIAN ? GridUnsafe.getCharLE(arr, pos): GridUnsafe.getChar(arr, pos);
}
 
开发者ID:apache,项目名称:ignite,代码行数:10,代码来源:BinaryPrimitives.java

示例14: readInt

/**
 * @param arr Array.
 * @param off Offset.
 * @return Value.
 */
public static int readInt(byte[] arr, int off) {
    long pos = GridUnsafe.BYTE_ARR_OFF + off;

    return BIG_ENDIAN ? GridUnsafe.getIntLE(arr, pos) : GridUnsafe.getInt(arr, pos);
}
 
开发者ID:apache,项目名称:ignite,代码行数:10,代码来源:BinaryPrimitives.java

示例15: readLong

/**
 * @param arr Array.
 * @param off Offset.
 * @return Value.
 */
public static long readLong(byte[] arr, int off) {
    long pos = GridUnsafe.BYTE_ARR_OFF + off;

    return BIG_ENDIAN ? GridUnsafe.getLongLE(arr, pos) : GridUnsafe.getLong(arr, pos);
}
 
开发者ID:apache,项目名称:ignite,代码行数:10,代码来源:BinaryPrimitives.java


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