// b = ResourceBundle.getBundle("open/NullCallerResource");
jobject b = m_ResourceBundle_getBundle.callReturnNotNull(
env->NewStringUTF("open/NullCallerResource"));
// fetch the open and closed classes
jclass class_OpenResources = env->FindClass("open/OpenResources");
assert(class_OpenResources != NULL);
jclass class_ClosedResources = env->FindClass("closed/ClosedResources");
assert(class_ClosedResources != NULL);
// Fetch the Module from one of the classes in the module
jobject n = m_Class_getModule.callReturnNotNull(class_OpenResources);
// Attempt to fetch an open resource from the module. It should return a valid stream. // InputStream in1 = n.getResourceAsStream("open/test.txt"); // in1.close();
jobject in1 = m_Module_getResourceAsStream.callReturnNotNull(n, env->NewStringUTF("open/test.txt"));
m_InputStream_close.callVoidMethod(in1);
// Attempt to fetch closed resource from the module. It should return null. // InputStream in2 = n.getResourceAsStream("closed/test.txt");
m_Module_getResourceAsStream.callReturnIsNull(n, env->NewStringUTF("closed/test.txt"));
// Attempt to fetch open resource from the class. It should return a valid stream. // InputStream in3 = open.OpenReosurces.class.getResourceAsStream("test.txt"); // in3.close();
jobject in3 = m_Class_getResourceAsStream.callReturnNotNull(
class_OpenResources, env->NewStringUTF("test.txt"));
m_InputStream_close.callVoidMethod(in3);
// Attempt to fetch closed resource from the class. It should return null. // InputStream in4 = closed.ClosedResources.class.getResourceAsStream("test.txt");
m_Class_getResourceAsStream.callReturnIsNull(
class_ClosedResources, env->NewStringUTF("test.txt"));
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.