add static NetConnection.getStateString
This commit is contained in:
parent
e451aa4da6
commit
204041aed7
|
@ -1038,7 +1038,11 @@ EOF
|
|||
NetConnection => <<'EOF',
|
||||
public native String getTypeString();
|
||||
|
||||
public native String getStateString();
|
||||
public native static String getStateString(int state);
|
||||
|
||||
public String getStateString() {
|
||||
return getStateString(this.state);
|
||||
}
|
||||
EOF
|
||||
Mem => <<'EOF',
|
||||
public String toString() {
|
||||
|
|
|
@ -765,13 +765,10 @@ JNIEXPORT jstring SIGAR_JNI(NetConnection_getTypeString)
|
|||
}
|
||||
|
||||
JNIEXPORT jstring SIGAR_JNI(NetConnection_getStateString)
|
||||
(JNIEnv *env, jobject obj)
|
||||
(JNIEnv *env, jobject cls, jint state)
|
||||
{
|
||||
jclass cls = JENV->GetObjectClass(env, obj);
|
||||
jfieldID field = JENV->GetFieldID(env, cls, "state", "I");
|
||||
jint type = JENV->GetIntField(env, obj, field);
|
||||
return JENV->NewStringUTF(env,
|
||||
sigar_net_connection_state_get(type));
|
||||
sigar_net_connection_state_get(state));
|
||||
}
|
||||
|
||||
JNIEXPORT jobjectArray SIGAR_JNI(Sigar_getWhoList)
|
||||
|
|
Loading…
Reference in New Issue