本文整理汇总了Java中com.sun.squawk.VM.setData方法的典型用法代码示例。如果您正苦于以下问题:Java VM.setData方法的具体用法?Java VM.setData怎么用?Java VM.setData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.squawk.VM
的用法示例。
在下文中一共展示了VM.setData方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setString
import com.sun.squawk.VM; //导入方法依赖的package包/类
/**
* Copy string value to the location at <code>offset</code>. Convert the data in <code>value</code> to a
* NULL-terminated C string, converted to native encoding.
*
* @param offset the byte offset of the c string from the base of this pointer
* @param value the string to copy
*/
public final void setString(int offset, String value) {
// optimize for 8-bit strings.
if (GC.getKlass(value).getSystemID() == CID.STRING_OF_BYTES) {
int len = value.length();
checkMultiWrite(offset, len + 1, 1);
VM.setData(getAddress(), offset, value, 0, len, 1);
setByte((long) len, (byte) 0); // null terminate
} else {
setString(offset, value.getBytes());
}
}
示例2: setBytes
import com.sun.squawk.VM; //导入方法依赖的package包/类
/**
* Sets <code>number</code> bytes starting at the given offset in the memory area
* associated with this object from the
* byte array passed starting at position <code>low</code>.
* <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
* to which to start writing.
*
* @param bytes The array from which the items are obtained.
*
* @param low The offset which is the starting point in the given array for the
* items to be obtained.
*
* @param number The number of items 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 a short falls in an invalid address range. This is checked at every
* entry in the array to allow for the possibility that the memory area
* could be unmapped or remapped. The store of the array into memory could, therefore, be
* only partially complete if the raw memory is unmapped or remapped mid-method.
*
*
* @throws ArrayIndexOutOfBoundsException Thrown if <code>low</code> is less than 0 or greater
* than <code>bytes.length - 1</code>, or if <code>low + number</code> is greater than or
* equal to <code>bytes.length</code>.
*
* @throws java.lang.SecurityException Thrown if this access is
* not permitted by the security manager.
*/
public void setBytes(long offset, byte[] bytes, int low, int number) {
int off = (int)offset;
checkMultiWrite(off, number, 1);
VM.setData(vbase, off, bytes, low, number, 1);
}
示例3: setFloats
import com.sun.squawk.VM; //导入方法依赖的package包/类
/**
* Sets <code>number</code> floats starting at the given offset in the memory area
* associated with this object from the
* float array passed starting at position <code>low</code>.
* On most processor architectures each aligned float can be stored in an atomic operation, but
* this is not required.
* <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 start writing.
*
* @param floats The array from which the items are obtained.
*
* @param low The offset which is the starting point in the given array for the
* items to be obtained.
*
* @param number The number of floats to write.
*
* @throws OffsetOutOfBoundsException Thrown if the offset is negative or greater than the size of the
* raw memory area. The role of the <code>SizeOutOfBoundsException</code> 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 float falls in an invalid address range. This is checked at every
* entry in the array to allow for the possibility that the memory area
* could be unmapped or remapped. The store of the array into memory could, therefore, be
* only partially complete if the raw memory is unmapped or remapped mid-method.
*
*
* @throws ArrayIndexOutOfBoundsException Thrown if <code>low</code> is less than 0 or greater
* than <code>bytes.length - 1</code>, or if <code>low + number</code> is greater than or
* equal to <code>bytes.length</code>.
*
* @throws java.lang.SecurityException Thrown if this access is
* not permitted by the security manager.
*/
public void setFloats(long offset, float[] floats, int low, int number) {
int off = (int) offset;
checkMultiWrite(off, number, 4);
VM.setData(vbase, off, floats, low, number, 4);
}
示例4: setLongs
import com.sun.squawk.VM; //导入方法依赖的package包/类
/**
* Sets <code>number</code> longs starting at the given offset in the memory area
* associated with this object from the
* long array passed starting at position <code>low</code>.
* Even if they are aligned, the long values may not be updated atomically. It is unspecified how many
* load and store operations will be used or in what order.
* <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 start writing.
*
* @param longs The array from which the items are obtained.
*
* @param low The offset which is the starting point in the given array for the
* items to be obtained.
*
* @param number The number of items 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 a short falls in an invalid address range. This is checked at every
* entry in the array to allow for the possibility that the memory area
* could be unmapped or remapped. The store of the array into memory could, therefore, be
* only partially complete if the raw memory is unmapped or remapped mid-method.
*
*
* @throws ArrayIndexOutOfBoundsException Thrown if <code>low</code> is less than 0 or greater
* than <code>bytes.length - 1</code>, or if <code>low + number</code> is greater than or
* equal to <code>bytes.length</code>.
*
* @throws java.lang.SecurityException Thrown if this access is
* not permitted by the security manager.
*/
public void setLongs(long offset, long[] longs, int low, int number) {
int off = (int)offset;
checkMultiWrite(off, number, 8);
VM.setData(vbase, off, longs, low, number, 8);
}
示例5: setShorts
import com.sun.squawk.VM; //导入方法依赖的package包/类
/**
* Sets <code>number</code> shorts starting at the given offset in the memory area
* associated with this object from the
* short array passed starting at position <code>low</code>.
* <p>
* Each write of a short value may involve a load and a store, and it may have unspecified
* effects on surrounding shorts in the presence of concurrent access - even on other shorts
* in the array.
* <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 start writing.
*
* @param shorts The array from which the items are obtained.
*
* @param low The offset which is the starting point in the given array for the
* items to be obtained.
*
* @param number The number of items 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 a short falls in an invalid address range. This is checked at every
* entry in the array to allow for the possibility that the memory area
* could be unmapped or remapped. The store of the array into memory could, therefore, be
* only partially complete if the raw memory is unmapped or remapped mid-method.
*
*
* @throws ArrayIndexOutOfBoundsException Thrown if <code>low</code> is less than 0 or greater
* than <code>bytes.length - 1</code>, or if <code>low + number</code> is greater than or
* equal to <code>bytes.length</code>.
*
* @throws java.lang.SecurityException Thrown if this access is
* not permitted by the security manager.
*/
public void setShorts(long offset, short[] shorts, int low, int number) {
int off = (int)offset;
checkMultiWrite(off, number, 2);
VM.setData(vbase, off, shorts, low, number, 2);
}
示例6: setDoubles
import com.sun.squawk.VM; //导入方法依赖的package包/类
/**
* Sets <code>number</code> doubles starting at the given offset in the memory area
* associated with this object from the
* double array passed starting at position <code>low</code>.
* Even if they are aligned, the double values may not be updated atomically. It is unspecified how many
* load and store operations will be used or in what order.
* <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 start writing.
*
* @param doubles The array from which the items are obtained.
*
* @param low The offset which is the starting point in the given array for the
* items to be obtained.
*
* @param number The number of items to write.
*
* @throws OffsetOutOfBoundsException Thrown if the offset is negative or greater than the size of the
* raw memory area. The role of the <code>SizeOutOfBoundsException</code> 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 a short falls in an invalid address range. This is checked at every
* entry in the array to allow for the possibility that the memory area
* could be unmapped or remapped. The <code>doubles</code> array could, therefore, be
* partially updated if the raw memory is unmapped or remapped mid-method.
*
*
* @throws ArrayIndexOutOfBoundsException Thrown if <code>low</code> is less than 0 or greater
* than <code>bytes.length - 1</code>, or if <code>low + number</code> is greater than or
* equal to <code>bytes.length</code>.
*
* @throws java.lang.SecurityException Thrown if this access is
* not permitted by the security manager.
*/
public void setDoubles(long offset, double[] doubles, int low, int number) {
int off = (int) offset;
checkMultiWrite(off, number, 8);
VM.setData(vbase, off, doubles, low, number, 8);
}
示例7: setInts
import com.sun.squawk.VM; //导入方法依赖的package包/类
/**
* Sets <code>number</code> ints starting at the given offset in the memory area
* associated with this object from the
* int array passed starting at position <code>low</code>.
* On most processor architectures each 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 start writing.
*
* @param ints The array from which the items are obtained.
*
* @param low The offset which is the starting point in the given array for the
* items to be obtained.
*
* @param number The number of items 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 an int falls in an invalid address range. This is checked at every
* entry in the array to allow for the possibility that the memory area
* could be unmapped or remapped. The store of the array into memory could, therefore, be
* only partially complete if the raw memory is unmapped or remapped mid-method.
*
*
* @throws ArrayIndexOutOfBoundsException Thrown if <code>low</code> is less than 0 or greater
* than <code>bytes.length - 1</code>, or if <code>low + number</code> is greater than or
* equal to <code>bytes.length</code>.
*
* @throws java.lang.SecurityException Thrown if this access is
* not permitted by the security manager.
*/
public void setInts(long offset, int[] ints, int low, int number) {
int off = (int)offset;
checkMultiWrite(off, number, 4);
VM.setData(vbase, off, ints, low, number, 4);
}