Beispiel #1
0
JNIEXPORT void JNICALL
Java_java_util_zip_Deflater_oneTimeInitialization (JNIEnv * env, jclass clazz)
{
  jfieldID fid;

  fid = (*env)->GetFieldID (env, clazz, "inRead", "I");
  if (!fid)
    return;
  JCL_CACHE_SET (env, FID_java_util_zip_Deflater_inRead, fid);

  fid = (*env)->GetFieldID (env, clazz, "finished", "Z");
  if (!fid)
    return;
  JCL_CACHE_SET (env, FID_java_util_zip_Deflater_finished, fid);
}
Beispiel #2
0
JNIEXPORT void JNICALL
Java_java_util_zip_ZipFile_ntvinit (JNIEnv * env, jclass cls)
{
  PORT_ACCESS_FROM_ENV (env);
  jmethodID mid;
  jfieldID descriptorFID;
  jclass javaClass;
  jclass weakJavaClass;
  JCLZipFileLink *zipfileHandles;

  javaClass = (*env)->FindClass (env, "java/util/zip/ZipEntry");
  weakJavaClass = (*env)->NewWeakGlobalRef (env, javaClass);
  if (!weakJavaClass)
    return;
  mid =
    ((*env)->
     GetMethodID (env, javaClass, "<init>",
                  "(Ljava/lang/String;Ljava/lang/String;[BJJJJIJJ)V"));
  if (!mid)
    return;
  JCL_CACHE_SET (env, CLS_java_util_zip_ZipEntry, weakJavaClass);
  JCL_CACHE_SET (env, MID_java_util_zip_ZipEntry_init, mid);

  descriptorFID = (*env)->GetFieldID (env, cls, "descriptor", "J");
  if (!descriptorFID)
    return;
  JCL_CACHE_SET (env, FID_java_util_zip_ZipFile_descriptor, descriptorFID);

  javaClass = (*env)->FindClass (env, "java/util/zip/ZipFile$ZFEnum");
  if (!javaClass)
    return;
  descriptorFID =
    (*env)->GetFieldID (env, javaClass, "nextEntryPointer", "J");
  if (!descriptorFID)
    return;
  JCL_CACHE_SET (env, FID_java_util_zip_ZipFile_nextEntryPointer,
                 descriptorFID);

  zipfileHandles = jclmem_allocate_memory (env, sizeof (JCLZipFileLink));
  if (!zipfileHandles)
    return;
  zipfileHandles->last = NULL;
  zipfileHandles->next = NULL;
  JCL_CACHE_SET (env, zipfile_handles, zipfileHandles);
}