本文整理了Java中sun.misc.Unsafe.putByte()
方法的一些代码示例,展示了Unsafe.putByte()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Unsafe.putByte()
方法的具体详情如下:
包路径:sun.misc.Unsafe
类名称:Unsafe
方法名:putByte
暂无
代码示例来源:origin: netty/netty
static void putByte(byte[] data, int index, byte value) {
UNSAFE.putByte(data, BYTE_ARRAY_BASE_OFFSET + index, value);
}
代码示例来源:origin: netty/netty
static void putByte(long address, byte value) {
UNSAFE.putByte(address, value);
}
代码示例来源:origin: prestodb/presto
void setByteUnchecked(int index, int value)
{
unsafe.putByte(base, address + index, (byte) (value & 0xFF));
}
代码示例来源:origin: redisson/redisson
@Override
public void put(long byteIndex, byte value) {
unsafe.putByte(baseAdress + byteIndex, value);
}
代码示例来源:origin: neo4j/neo4j
public static void putByte( Object obj, long offset, byte value )
{
unsafe.putByte( obj, offset, value );
}
代码示例来源:origin: redisson/redisson
static void putByte(long address, byte value) {
UNSAFE.putByte(address, value);
}
代码示例来源:origin: redisson/redisson
static void putByte(byte[] data, int index, byte value) {
UNSAFE.putByte(data, BYTE_ARRAY_BASE_OFFSET + index, value);
}
代码示例来源:origin: apache/ignite
/**
* Stores byte value into object field.
*
* @param obj Object.
* @param fieldOff Field offset.
* @param val Value.
*/
public static void putByteField(Object obj, long fieldOff, byte val) {
UNSAFE.putByte(obj, fieldOff, val);
}
代码示例来源:origin: apache/ignite
/**
* Stores byte value into byte array.
*
* @param arr Byte array.
* @param off Offset.
* @param val Value.
*/
public static void putByte(byte[] arr, long off, byte val) {
UNSAFE.putByte(arr, off, val);
}
代码示例来源:origin: apache/ignite
/**
* Stores given byte value.
*
* @param addr Address.
* @param val Value.
*/
public static void putByte(long addr, byte val) {
UNSAFE.putByte(addr, val);
}
代码示例来源:origin: graphhopper/graphhopper
@Override
public final void setBytes(long bytePos, byte[] values, int length) {
for (int offset = 0; offset < length; offset++) {
UNSAFE.putByte(address + bytePos + offset, values[offset]);
}
}
代码示例来源:origin: wildfly/wildfly
static void putByte(long address, byte value) {
UNSAFE.putByte(address, value);
}
代码示例来源:origin: prestodb/presto
public void clear(int offset, int length)
{
while (length >= SIZE_OF_LONG) {
unsafe.putLong(base, address + offset, 0);
offset += SIZE_OF_LONG;
length -= SIZE_OF_LONG;
}
while (length > 0) {
unsafe.putByte(base, address + offset, (byte) 0);
offset++;
length--;
}
}
代码示例来源:origin: bytedeco/javacpp
@Override void putByte(byte[] array, long offset, byte b) { UNSAFE.putByte(array, arrayOffset + offset, b); }
@Override short getShort(byte[] array, long offset) { return UNSAFE.getShort(array, arrayOffset + offset); }
代码示例来源:origin: apache/flink
@Override
public final void put(int index, byte b) {
final long pos = address + index;
if (index >= 0 && pos < addressLimit) {
UNSAFE.putByte(heapMemory, pos, b);
}
else if (address > addressLimit) {
throw new IllegalStateException("segment has been freed");
}
else {
// index is in fact invalid
throw new IndexOutOfBoundsException();
}
}
代码示例来源:origin: redisson/redisson
@Override
public void put(long byteIndex, byte value) {
checkIndex(byteIndex,1);
unsafe.putByte(base,off+byteIndex,value);
}
代码示例来源:origin: redisson/redisson
public final void setByteValue(Object newObj, byte b) throws IllegalAccessException {
if (!isAndroid && memOffset >= 0) {
FSTUtil.unFlaggedUnsafe.putByte(newObj, memOffset, b);
return;
}
field.setByte(newObj, b);
}
代码示例来源:origin: neo4j/neo4j
public static void putByte( long address, byte value )
{
checkAccess( address, Byte.BYTES );
unsafe.putByte( address, value );
}
代码示例来源:origin: prestodb/presto
/**
* Fill the slice with the specified value;
*/
public void fill(byte value)
{
int offset = 0;
int length = size;
long longValue = fillLong(value);
while (length >= SIZE_OF_LONG) {
unsafe.putLong(base, address + offset, longValue);
offset += SIZE_OF_LONG;
length -= SIZE_OF_LONG;
}
while (length > 0) {
unsafe.putByte(base, address + offset, value);
offset++;
length--;
}
}
代码示例来源:origin: neo4j/neo4j
/**
* Set the given number of bytes to the given value, starting from the given address.
*/
public static void setMemory( long address, long bytes, byte value )
{
if ( 0 == (address & 1) && bytes > 64 )
{
unsafe.putByte( address, value );
unsafe.setMemory( address + 1, bytes - 1, value );
}
else
{
unsafe.setMemory( address, bytes, value );
}
}
内容来源于网络,如有侵权,请联系作者删除!