< prev index next >

src/java.base/share/native/libjimage/jimage.hpp

Print this page

  1 /*
  2  * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  3  *
  4  * Redistribution and use in source and binary forms, with or without
  5  * modification, are permitted provided that the following conditions
  6  * are met:
  7  *
  8  *   - Redistributions of source code must retain the above copyright
  9  *     notice, this list of conditions and the following disclaimer.
 10  *
 11  *   - Redistributions in binary form must reproduce the above copyright
 12  *     notice, this list of conditions and the following disclaimer in the
 13  *     documentation and/or other materials provided with the distribution.
 14  *
 15  *   - Neither the name of Oracle nor the names of its
 16  *     contributors may be used to endorse or promote products derived
 17  *     from this software without specific prior written permission.
 18  *
 19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
 20  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 21  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR

 76 JIMAGE_Open(const char *name, jint* error);
 77 
 78 typedef JImageFile* (*JImageOpen_t)(const char *name, jint* error);
 79 
 80 /*
 81  * JImageClose - Given the supplied open image file (see JImageOpen), release
 82  * memory and resources used by the open file and close the file. If the image
 83  * file is shared by other uses, release and close is deferred until the last use
 84  * is also closed.
 85  *
 86  * Ex.
 87  *  (*JImageClose)(image);
 88  */
 89 
 90 extern "C" JNIEXPORT void
 91 JIMAGE_Close(JImageFile* jimage);
 92 
 93 typedef void (*JImageClose_t)(JImageFile* jimage);
 94 
 95 
 96 /*
 97  * JImagePackageToModule - Given an open image file (see JImageOpen) and the name
 98  * of a package, return the name of module where the package resides. If the
 99  * package does not exist in the image file, the function returns NULL.
100  * The resulting string does/should not have to be released. All strings are
101  * utf-8, zero byte terminated.
102  *
103  * Ex.
104  *  const char* package = (*JImagePackageToModule)(image, "java/lang");
105  *  tty->print_cr(package);
106  *  -> java.base
107  */
108 
109 extern "C" JNIEXPORT const char *
110 JIMAGE_PackageToModule(JImageFile* jimage, const char* package_name);
111 
112 typedef const char* (*JImagePackageToModule_t)(JImageFile* jimage, const char* package_name);
113 
114 
115 /*
116  * JImageFindResource - Given an open image file (see JImageOpen), a module
117  * name, a version string and the name of a class/resource, return location
118  * information describing the resource and its size. If no resource is found, the
119  * function returns JIMAGE_NOT_FOUND and the value of size is undefined.
120  * The version number should be "9.0" and is not used in locating the resource.
121  * The resulting location does/should not have to be released.
122  * All strings are utf-8, zero byte terminated.
123  *
124  *  Ex.
125  *   jlong size;
126  *   JImageLocationRef location = (*JImageFindResource)(image,
127  *                                "java.base", "9.0", "java/lang/String.class", &size);
128  */
129 extern "C" JNIEXPORT JImageLocationRef JIMAGE_FindResource(JImageFile* jimage,
130         const char* module_name, const char* version, const char* name,
131         jlong* size);
132 
133 typedef JImageLocationRef(*JImageFindResource_t)(JImageFile* jimage,
134         const char* module_name, const char* version, const char* name,

  1 /*
  2  * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  3  *
  4  * Redistribution and use in source and binary forms, with or without
  5  * modification, are permitted provided that the following conditions
  6  * are met:
  7  *
  8  *   - Redistributions of source code must retain the above copyright
  9  *     notice, this list of conditions and the following disclaimer.
 10  *
 11  *   - Redistributions in binary form must reproduce the above copyright
 12  *     notice, this list of conditions and the following disclaimer in the
 13  *     documentation and/or other materials provided with the distribution.
 14  *
 15  *   - Neither the name of Oracle nor the names of its
 16  *     contributors may be used to endorse or promote products derived
 17  *     from this software without specific prior written permission.
 18  *
 19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
 20  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 21  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR

 76 JIMAGE_Open(const char *name, jint* error);
 77 
 78 typedef JImageFile* (*JImageOpen_t)(const char *name, jint* error);
 79 
 80 /*
 81  * JImageClose - Given the supplied open image file (see JImageOpen), release
 82  * memory and resources used by the open file and close the file. If the image
 83  * file is shared by other uses, release and close is deferred until the last use
 84  * is also closed.
 85  *
 86  * Ex.
 87  *  (*JImageClose)(image);
 88  */
 89 
 90 extern "C" JNIEXPORT void
 91 JIMAGE_Close(JImageFile* jimage);
 92 
 93 typedef void (*JImageClose_t)(JImageFile* jimage);
 94 
 95 



















 96 /*
 97  * JImageFindResource - Given an open image file (see JImageOpen), a module
 98  * name, a version string and the name of a class/resource, return location
 99  * information describing the resource and its size. If no resource is found, the
100  * function returns JIMAGE_NOT_FOUND and the value of size is undefined.
101  * The version number should be "9.0" and is not used in locating the resource.
102  * The resulting location does/should not have to be released.
103  * All strings are utf-8, zero byte terminated.
104  *
105  *  Ex.
106  *   jlong size;
107  *   JImageLocationRef location = (*JImageFindResource)(image,
108  *                                "java.base", "9.0", "java/lang/String.class", &size);
109  */
110 extern "C" JNIEXPORT JImageLocationRef JIMAGE_FindResource(JImageFile* jimage,
111         const char* module_name, const char* version, const char* name,
112         jlong* size);
113 
114 typedef JImageLocationRef(*JImageFindResource_t)(JImageFile* jimage,
115         const char* module_name, const char* version, const char* name,
< prev index next >