add static NetConnection.getStateString

This commit is contained in:
Doug MacEachern 2005-05-07 06:01:32 +00:00
parent e451aa4da6
commit 204041aed7
2 changed files with 7 additions and 6 deletions

View File

@ -1038,7 +1038,11 @@ EOF
NetConnection => <<'EOF', NetConnection => <<'EOF',
public native String getTypeString(); public native String getTypeString();
public native String getStateString(); public native static String getStateString(int state);
public String getStateString() {
return getStateString(this.state);
}
EOF EOF
Mem => <<'EOF', Mem => <<'EOF',
public String toString() { public String toString() {

View File

@ -765,13 +765,10 @@ JNIEXPORT jstring SIGAR_JNI(NetConnection_getTypeString)
} }
JNIEXPORT jstring SIGAR_JNI(NetConnection_getStateString) 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, return JENV->NewStringUTF(env,
sigar_net_connection_state_get(type)); sigar_net_connection_state_get(state));
} }
JNIEXPORT jobjectArray SIGAR_JNI(Sigar_getWhoList) JNIEXPORT jobjectArray SIGAR_JNI(Sigar_getWhoList)