jdk/src/java.base/share/classes/jdk/internal/jimage/ImageNativeSubstrate.java
changeset 32649 2ee9017c7597
parent 32641 ac2c73b45253
child 32834 e1dca5fe4de3
equal deleted inserted replaced
32648:1fa861caf840 32649:2ee9017c7597
    47 
    47 
    48     private final long id;
    48     private final long id;
    49     private final long indexAddress;
    49     private final long indexAddress;
    50     private final long dataAddress;
    50     private final long dataAddress;
    51 
    51 
    52     native static long openImage(String imagePath, boolean bigEndian);
    52     static native long openImage(String imagePath, boolean bigEndian);
    53     native static void closeImage(long id);
    53     static native void closeImage(long id);
    54     native static long getIndexAddress(long id);
    54     static native long getIndexAddress(long id);
    55     native static long getDataAddress(long id);
    55     static native long getDataAddress(long id);
    56     native static boolean readCompressed(long id, long offset,
    56     static native boolean readCompressed(long id, long offset,
    57             ByteBuffer compressedBuffer, long compressedSize,
    57             ByteBuffer compressedBuffer, long compressedSize,
    58             ByteBuffer uncompressedBuffer, long uncompressedSize);
    58             ByteBuffer uncompressedBuffer, long uncompressedSize);
    59     native static boolean read(long id, long offset,
    59     static native boolean read(long id, long offset,
    60             ByteBuffer uncompressedBuffer, long uncompressedSize);
    60             ByteBuffer uncompressedBuffer, long uncompressedSize);
    61     native static byte[] getStringBytes(long id, int offset);
    61     static native byte[] getStringBytes(long id, int offset);
    62     native static long[] getAttributes(long id, int offset);
    62     static native long[] getAttributes(long id, int offset);
    63     native static long[] findAttributes(long id, byte[] path);
    63     static native long[] findAttributes(long id, byte[] path);
    64     native static int[] attributeOffsets(long id);
    64     static native int[] attributeOffsets(long id);
    65 
    65 
    66     public native static long JIMAGE_Open(String path) throws IOException;
    66     public static native long JIMAGE_Open(String path) throws IOException;
    67     public native static void JIMAGE_Close(long jimageHandle);
    67     public static native void JIMAGE_Close(long jimageHandle);
    68     public native static long JIMAGE_FindResource(long jimageHandle,
    68     public static native long JIMAGE_FindResource(long jimageHandle,
    69                     String moduleName, String Version, String path,
    69                     String moduleName, String Version, String path,
    70                     long[] size);
    70                     long[] size);
    71     public native static long JIMAGE_GetResource(long jimageHandle,
    71     public static native long JIMAGE_GetResource(long jimageHandle,
    72                     long locationHandle, byte[] buffer, long size);
    72                     long locationHandle, byte[] buffer, long size);
    73     // Get an array of names that match; return the count found upto array size
    73     // Get an array of names that match; return the count found upto array size
    74     public native static int JIMAGE_Resources(long jimageHandle,
    74     public static native int JIMAGE_Resources(long jimageHandle,
    75                     String[] outputNames);
    75                     String[] outputNames);
    76     // Return the module name for the package
    76     // Return the module name for the package
    77     public native static String JIMAGE_PackageToModule(long imageHandle,
    77     public static native String JIMAGE_PackageToModule(long imageHandle,
    78                     String packageName);
    78                     String packageName);
    79 
    79 
    80     static ByteBuffer newDirectByteBuffer(long address, long capacity) {
    80     static ByteBuffer newDirectByteBuffer(long address, long capacity) {
    81         assert capacity < Integer.MAX_VALUE;
    81         assert capacity < Integer.MAX_VALUE;
    82         return NIOACCESS.newDirectByteBuffer(address, (int)capacity, null);
    82         return NIOACCESS.newDirectByteBuffer(address, (int)capacity, null);