本文整理汇总了Java中com.sun.squawk.NativeUnsafe.setUnalignedInt方法的典型用法代码示例。如果您正苦于以下问题:Java NativeUnsafe.setUnalignedInt方法的具体用法?Java NativeUnsafe.setUnalignedInt怎么用?Java NativeUnsafe.setUnalignedInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.squawk.NativeUnsafe
的用法示例。
在下文中一共展示了NativeUnsafe.setUnalignedInt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setInt
import com.sun.squawk.NativeUnsafe; //导入方法依赖的package包/类
/**
* Sets the <code>int</code> at the given offset in the memory area
* associated with this object.
* On most processor architectures an aligned integer can be stored in an atomic operation, but
* this is not required.
* <p>
* This memory access may involve multiple load and a store operations, and it may have unspecified
* effects on surrounding bytes (even bytes in the range being stored)
* in the presence of concurrent access.
* <p>
* Caching of the memory access is controlled by the memory <code>type</code> requested
* when the <code>RawMemoryAccess</code> instance was created. If the memory is not cached,
* this method guarantees serialized access (that is, the memory access at the memory
* occurs in the same order as in the program. Multiple writes to the same location
* may not be coalesced.)
*
* @param offset The offset in bytes from the beginning of the raw memory area
* at which to write the integer.
*
* @param value The integer to write.
*
* @throws OffsetOutOfBoundsException Thrown if the offset is negative or greater than the size of the
* raw memory area. The role of the {@link SizeOutOfBoundsException} somewhat overlaps
* this exception since it is thrown if the offset is within the object but outside the
* mapped area. (See {@link RawMemoryAccess#map(long base, long size)}).
*
* @throws SizeOutOfBoundsException Thrown if the object is not mapped,
* or if the integer falls in an invalid address range.
*
* @throws java.lang.SecurityException Thrown if this access is
* not permitted by the security manager.
*/
public void setInt(long offset, int value) {
int off = (int)offset;
checkWrite(off, 4);
NativeUnsafe.setUnalignedInt(vbase, off, value);
}