APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.internal.jmod

public Class JmodFile

extends Object
implements AutoCloseable
Class Inheritance
All Implemented Interfaces
java.lang.AutoCloseable
Imports
java.io.IOException, .InputStream, .OutputStream, java.nio.file.Files, .Path, java.util.Arrays, .Map, java.util.function.Function, java.util.stream.Collectors, .Stream, java.util.zip.ZipEntry, .ZipFile

Helper class to read JMOD file

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
JmodFile.Entry

JMOD file entry.

public static enum
JmodFile.Section

JMOD sections

Field Summary

Modifier and TypeField and Description
private final Path
private static final byte[]
private static final int
private static final int
private final ZipFile

Constructor Summary

AccessConstructor and Description
public
JmodFile(Path file)

Constructs a JmodFile from a given path.

Method Summary

Modifier and TypeMethod and Description
public static void
public void
close()

Implements java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

public JmodFile.Entry
getEntry(JmodFile.Section section, String name)

Returns the Entry for a resource in a JMOD file section or null if not found.

public InputStream
getInputStream(JmodFile.Section section, String name)

Opens an InputStream for reading the named entry of the given section in this JMOD file.

public InputStream
getInputStream(JmodFile.Entry entry)

Opens an InputStream for reading an entry in the JMOD file.

public Stream<JmodFile.Entry>
stream()

Returns a stream of entries in this JMOD file.

public static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fileback to summary
private final Path file
JMOD_MAGIC_NUMBERback to summary
private static final byte[] JMOD_MAGIC_NUMBER
JMOD_MAJOR_VERSIONback to summary
private static final int JMOD_MAJOR_VERSION
JMOD_MINOR_VERSIONback to summary
private static final int JMOD_MINOR_VERSION
zipfileback to summary
private final ZipFile zipfile

Constructor Detail

JmodFileback to summary
public JmodFile(Path file) throws IOException

Constructs a JmodFile from a given path.

Method Detail

checkMagicback to summary
public static void checkMagic(Path file) throws IOException
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
getEntryback to summary
public JmodFile.Entry getEntry(JmodFile.Section section, String name)

Returns the Entry for a resource in a JMOD file section or null if not found.

getInputStreamback to summary
public InputStream getInputStream(JmodFile.Section section, String name) throws IOException

Opens an InputStream for reading the named entry of the given section in this JMOD file.

Exceptions
IOException:
if the named entry is not found, or I/O error occurs when reading it
getInputStreamback to summary
public InputStream getInputStream(JmodFile.Entry entry) throws IOException

Opens an InputStream for reading an entry in the JMOD file.

Exceptions
IOException:
if an I/O error occurs
streamback to summary
public Stream<JmodFile.Entry> stream()

Returns a stream of entries in this JMOD file.

writeMagicNumberback to summary
public static void writeMagicNumber(OutputStream os) throws IOException
jdk.internal.jmod back to summary

public Class JmodFile.Entry

extends Object
Class Inheritance

JMOD file entry. Each entry corresponds to a ZipEntry whose name is: Section::jmodDir + '/' + name

Field Summary

Modifier and TypeField and Description
private final String
pack-priv static final Map<String, JmodFile.Section>
private final JmodFile.Section
private final ZipEntry

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
isDirectory()

Returns true if the entry is a directory in the JMOD file.

public String
name()

Returns the name of this entry.

public JmodFile.Section
section()

Returns the section of this entry.

pack-priv static JmodFile.Section
public long
size()

Returns the size of this entry.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public ZipEntry
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

nameback to summary
private final String name
NAME_TO_SECTIONback to summary
pack-priv static final Map<String, JmodFile.Section> NAME_TO_SECTION
sectionback to summary
private final JmodFile.Section section
zipEntryback to summary
private final ZipEntry zipEntry

Constructor Detail

Entryback to summary
private Entry(ZipEntry e)

Method Detail

isDirectoryback to summary
public boolean isDirectory()

Returns true if the entry is a directory in the JMOD file.

nameback to summary
public String name()

Returns the name of this entry.

sectionback to summary
public JmodFile.Section section()

Returns the section of this entry.

sectionback to summary
pack-priv static JmodFile.Section section(String name)
sizeback to summary
public long size()

Returns the size of this entry.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
zipEntryback to summary
public ZipEntry zipEntry()
jdk.internal.jmod back to summary

public final Enum JmodFile.Section

extends Enum<JmodFile.Section>
Class Inheritance

JMOD sections

Field Summary

Modifier and TypeField and Description
public static final JmodFile.Section
public static final JmodFile.Section
public static final JmodFile.Section
private final String
public static final JmodFile.Section
public static final JmodFile.Section
public static final JmodFile.Section
public static final JmodFile.Section

Constructor Summary

AccessConstructor and Description
private
Section(String jmodDir)

Method Summary

Modifier and TypeMethod and Description
public String
jmodDir()

Returns the directory name in the JMOD file corresponding to this section

public static JmodFile.Section
public static JmodFile.Section[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CLASSESback to summary
public static final JmodFile.Section CLASSES
CONFIGback to summary
public static final JmodFile.Section CONFIG
HEADER_FILESback to summary
public static final JmodFile.Section HEADER_FILES
jmodDirback to summary
private final String jmodDir
LEGAL_NOTICESback to summary
public static final JmodFile.Section LEGAL_NOTICES
MAN_PAGESback to summary
public static final JmodFile.Section MAN_PAGES
NATIVE_CMDSback to summary
public static final JmodFile.Section NATIVE_CMDS
NATIVE_LIBSback to summary
public static final JmodFile.Section NATIVE_LIBS

Constructor Detail

Sectionback to summary
private Section(String jmodDir)

Method Detail

jmodDirback to summary
public String jmodDir()

Returns the directory name in the JMOD file corresponding to this section

valueOfback to summary
public static JmodFile.Section valueOf(String name)
valuesback to summary
public static JmodFile.Section[] values()