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


Java GridUnsafe.putByte方法代码示例

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


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

示例1: writeByte

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void writeByte(byte val) {
    lastFinished = buf.remaining() >= 1;

    if (lastFinished) {
        int pos = buf.position();

        GridUnsafe.putByte(heapArr, baseOff + pos, val);

        buf.position(pos + 1);
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:13,代码来源:DirectByteBufferStreamImplV1.java

示例2: writeArrayLE

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
 * @param arr Array.
 * @param off Offset.
 * @param len Length.
 * @param typeSize Primitive type size in bytes.
 */
private void writeArrayLE(Object arr, long off, int len, int typeSize) {
    int pos = buf.position();

    for (int i = 0; i < len; i++) {
        for (int j = 0; j < typeSize; j++) {
            byte b = GridUnsafe.getByteField(arr, off + arrOff + (typeSize - j - 1));

            GridUnsafe.putByte(heapArr, baseOff + pos++, b);
        }

        buf.position(pos);
        arrOff += typeSize;
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:21,代码来源:DirectByteBufferStreamImplV2.java

示例3: writeByte

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void writeByte(int v) throws IOException {
    requestFreeSize(1);

    GridUnsafe.putByte(bytes, BYTE_ARR_OFF + off, (byte)v);

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

示例4: writeByte

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void writeByte(byte val) {
    ensureCapacity(pos + 1);

    GridUnsafe.putByte(data + pos++, val);
}
 
开发者ID:apache,项目名称:ignite,代码行数:7,代码来源:PlatformOutputStreamImpl.java

示例5: unsafeWriteByte

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void unsafeWriteByte(byte val) {
    GridUnsafe.putByte(data + pos++, val);
}
 
开发者ID:apache,项目名称:ignite,代码行数:5,代码来源:PlatformOutputStreamImpl.java

示例6: writeByteAndShift

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected void writeByteAndShift(byte val) {
    GridUnsafe.putByte(ptr + pos++, val);
}
 
开发者ID:apache,项目名称:ignite,代码行数:5,代码来源:BinaryOffheapOutputStream.java

示例7: unsafeWriteByte

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void unsafeWriteByte(byte val) {
    GridUnsafe.putByte(ptr + pos++, val);
}
 
开发者ID:apache,项目名称:ignite,代码行数:5,代码来源:BinaryOffheapOutputStream.java

示例8: unsafeWriteByte

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void unsafeWriteByte(byte val) {
    GridUnsafe.putByte(data, GridUnsafe.BYTE_ARR_OFF + pos++, val);
}
 
开发者ID:apache,项目名称:ignite,代码行数:5,代码来源:BinaryHeapOutputStream.java

示例9: testUnsafe

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
 * Test unsafe vs. new.
 */
@SuppressWarnings("JavaDoc")
private static void testUnsafe() throws InterruptedException {
    X.println("Testing unsafe...");

    int MAX = 1000000;

    long[] addrs = new long[MAX];

    System.gc();

    GridTimer t = new GridTimer("unsafe");

    int mem = 1024;

    for (int i = 0; i < MAX; i++) {
        addrs[i] = GridUnsafe.allocateMemory(mem);

        GridUnsafe.putByte(addrs[i] + RAND.nextInt(mem), (byte)RAND.nextInt(mem));

        v = GridUnsafe.getByte(addrs[i] + RAND.nextInt(mem));
    }

    X.println("Unsafe [time=" + t.stop() + "ms, v=" + v + ']');

    Thread.sleep(5000L);

    for (long l : addrs)
        GridUnsafe.freeMemory(l);
}
 
开发者ID:apache,项目名称:ignite,代码行数:33,代码来源:GridBasicPerformanceTest.java

示例10: writeByte

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
 * @param arr Array.
 * @param off Offset.
 * @param val Value.
 */
public static void writeByte(byte[] arr, int off, byte val) {
    GridUnsafe.putByte(arr, GridUnsafe.BYTE_ARR_OFF + off, val);
}
 
开发者ID:apache,项目名称:ignite,代码行数:9,代码来源:BinaryPrimitives.java

示例11: writeByte

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
 * @param ptr Pointer.
 * @param v Integer value.
 */
public void writeByte(long ptr, byte v) {
    GridUnsafe.putByte(ptr, v);
}
 
开发者ID:apache,项目名称:ignite,代码行数:8,代码来源:GridUnsafeMemory.java


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