APIdia Launch Partner
Top Inners Fields Constructors Methods
jdk.internal.jimage

public Class BasicImageReader

extends Object
implements AutoCloseable
Class Inheritance
All Implemented Interfaces
java.lang.AutoCloseable
Known Direct Subclasses
jdk.internal.jimage.ImageReader.SharedImageReader
Imports
java.io.ByteArrayInputStream, .IOException, .InputStream, java.lang.reflect.InvocationTargetException, .Method, java.nio.ByteBuffer, .ByteOrder, .IntBuffer, java.nio.channels.FileChannel, java.nio.file.Path, .StandardOpenOption, java.security.AccessController, .PrivilegedAction, java.util.NoSuchElementException, .Objects, java.util.stream.IntStream, .Stream, jdk.internal.jimage.decompressor.Decompressor

Implementation Note

This class needs to maintain JDK 8 source compatibility. It is used internally in the JDK to implement jimage/jrtfs access, but also compiled and delivered as part of the jrtfs.jar to support access to the jimage file provided by the shipped JDK by tools running on JDK 8.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private final ByteOrder
private final FileChannel
private final Decompressor
private final ImageHeader
private final Path
private final long
private static final boolean
private final ByteBuffer
private static final boolean
private final ByteBuffer
private final String
private final IntBuffer
private final IntBuffer
private final ByteBuffer
private final ImageStringsReader
private static final boolean

Constructor Summary

AccessConstructor and Description
protected
BasicImageReader(Path path, ByteOrder byteOrder)

protected

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

public ImageLocation
findLocation(String module, String name)

public ImageLocation
public long[]
getAttributes(int offset)

private byte[]
public ByteOrder
public String[]
public ImageHeader
public Path
pack-priv ImageLocation
getLocation(int offset)

public int
private int
public String
public byte[]
public byte[]
public ByteBuffer
getResourceBuffer(ImageLocation loc)

Returns the content of jimage location in a newly allocated byte buffer.

pack-priv ResourceEntries
getResourceEntries()

Returns the "raw" API for accessing underlying jimage resource entries.

public InputStream
public String
getString(int offset)

public ImageStringsReader
private IntBuffer
intBuffer(ByteBuffer buffer, int offset, int size)

private static boolean
public int
match(int offset, String string, int stringOffset)

public static BasicImageReader
open(Path imagePath)

private ByteBuffer
readBuffer(long offset, long size)

private ImageHeader
private static ByteBuffer
slice(ByteBuffer buffer, int position, int capacity)

public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

byteOrderback to summary
private final ByteOrder byteOrder
channelback to summary
private final FileChannel channel
decompressorback to summary
private final Decompressor decompressor
imagePathback to summary
private final Path imagePath
indexSizeback to summary
private final long indexSize
IS_64_BITback to summary
private static final boolean IS_64_BIT
locationsback to summary
private final ByteBuffer locations
MAP_ALLback to summary
private static final boolean MAP_ALL
memoryMapback to summary
private final ByteBuffer memoryMap
nameback to summary
private final String name
offsetsback to summary
private final IntBuffer offsets
redirectback to summary
private final IntBuffer redirect
stringsback to summary
private final ByteBuffer strings
stringsReaderback to summary
private final ImageStringsReader stringsReader
USE_JVM_MAPback to summary
private static final boolean USE_JVM_MAP

Constructor Detail

BasicImageReaderback to summary
protected BasicImageReader(Path path, ByteOrder byteOrder) throws IOException
Annotations
@SuppressWarnings:removal, this-escape, suppression
BasicImageReaderback to summary
protected BasicImageReader(Path imagePath) throws IOException

Method Detail

closeback to summary
public void close() throws IOException

Implements java.lang.AutoCloseable.close.

Doc from java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Annotations
@Override
findLocationback to summary
public ImageLocation findLocation(String module, String name)
findLocationback to summary
public ImageLocation findLocation(String name)
getAttributesback to summary
public long[] getAttributes(int offset)
getBufferBytesback to summary
private byte[] getBufferBytes(ByteBuffer buffer)
getByteOrderback to summary
public ByteOrder getByteOrder()
getEntryNamesback to summary
public String[] getEntryNames()
getHeaderback to summary
public ImageHeader getHeader()
getImagePathback to summary
public Path getImagePath()
getLocationback to summary
pack-priv ImageLocation getLocation(int offset)
getLocationIndexback to summary
public int getLocationIndex(String name)
getLocationIndexback to summary
private int getLocationIndex(String module, String name)
getNameback to summary
public String getName()
getResourceback to summary
public byte[] getResource(String name)
getResourceback to summary
public byte[] getResource(ImageLocation loc)
getResourceBufferback to summary
public ByteBuffer getResourceBuffer(ImageLocation loc)

Returns the content of jimage location in a newly allocated byte buffer.

getResourceEntriesback to summary
pack-priv ResourceEntries getResourceEntries()

Returns the "raw" API for accessing underlying jimage resource entries.

This is only meaningful for use by code dealing directly with jimage files, and cannot be used to reliably lookup resources used at runtime.

The returned ResourceEntries remains valid until the image reader from which it was obtained is closed.

getResourceStreamback to summary
public InputStream getResourceStream(ImageLocation loc)
getStringback to summary
public String getString(int offset)
getStringsback to summary
public ImageStringsReader getStrings()
intBufferback to summary
private IntBuffer intBuffer(ByteBuffer buffer, int offset, int size)
isSystemPropertyback to summary
private static boolean isSystemProperty(String key, String value, String def)
Annotations
@SuppressWarnings:removal, suppression
matchback to summary
public int match(int offset, String string, int stringOffset)
openback to summary
public static BasicImageReader open(Path imagePath) throws IOException
readBufferback to summary
private ByteBuffer readBuffer(long offset, long size)
readHeaderback to summary
private ImageHeader readHeader(IntBuffer buffer) throws IOException
sliceback to summary
private static ByteBuffer slice(ByteBuffer buffer, int position, int capacity)
verifyLocationback to summary
public boolean verifyLocation(String module, String name)
jdk.internal.jimage back to summary

public final Class BasicImageReader.ImageVersionMismatchException

extends IOException
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv
ImageVersionMismatchException(String name, int majorVersion, int minorVersion)

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.io.IOException.serialVersionUID.

Deprecated

Annotations
@Deprecated

Constructor Detail

ImageVersionMismatchExceptionback to summary
pack-priv ImageVersionMismatchException(String name, int majorVersion, int minorVersion)