Get<PrimitiveType>ArrayRegion Routines - GetFloatArrayRegion
void Get<PrimitiveType>ArrayRegion
(JNIEnv *env,
ArrayType array,
jsize start, jsize len,
NativeType *buf);
A family of functions that copies a region of a primitive array into a buffer.
The following table describes the specific primitive array element accessors. You should do the following substitutions:(GetFloatArrayRegion)
- Replace Get<PrimitiveType>ArrayRegion with one of the actual primitive element accessor routine names from Table 4-12.
- Replace ArrayType with the corresponding array type.
- Replace NativeType with the corresponding native type for that routine.
Table 4-12a Get<PrimitiveType>ArrayRegion Family of Array Accessor Routines
LINKAGE of GetFloatArrayRegion
Indices in the JNIEnv interface function table.
Table 4-12b Get<PrimitiveType>ArrayRegion Family of Array Accessor Routines
PARAMETERS of GetFloatArrayRegion
env
: the JNI interface pointer.array
: a Java array.start
: the starting index.len
: the number of elements to be copied.buf
: the destination buffer.THROWS:
ArrayIndexOutOfBoundsException
: if one of the indexes in the region is not valid.
Example of GetFloatArrayRegion
case 'F': { m_cmdParser->reply.WriteByte(JDWP_TAG_FLOAT); m_cmdParser->reply.WriteInt(length); if ( length == 0 ) { return; } jfloat* bufferArray = reinterpret_cast<jfloat*>(AgentBase::GetMemoryManager() .Allocate(sizeof(jfloat)*length JDWP_FILE_LINE)); AgentAutoFree scavenger(bufferArray JDWP_FILE_LINE); jni->GetFloatArrayRegion(static_cast<jfloatArray>(arrayObject), firstIndex, length, bufferArray); classManager.CheckOnException(jni); for (int i = 0; i < length; i++) { value.f = bufferArray[i]; JDWP_TRACE_DATA("GetValues: send: index=" << i << ", value=(float)" << value.f); m_cmdParser->reply.WriteUntaggedValue(jni, JDWP_TAG_FLOAT, value); } return; }