Package org.eclipse.jetty.util
Class MultiReleaseJarFile
- java.lang.Object
-
- org.eclipse.jetty.util.MultiReleaseJarFile
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class MultiReleaseJarFile extends Object implements Closeable
Utility class to handle a Multi Release Jar file
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classMultiReleaseJarFile.VersionedJarEntryA versioned Jar entry
-
Constructor Summary
Constructors Constructor Description MultiReleaseJarFile(File file)Construct a multi release jar file for the current JVM version, ignoring directories.MultiReleaseJarFile(File file, int javaPlatform, boolean includeDirectories)Construct a multi release jar file
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()MultiReleaseJarFile.VersionedJarEntrygetEntry(String name)Get a versioned resource entry by nameintgetVersion()booleanisMultiRelease()Stream<MultiReleaseJarFile.VersionedJarEntry>stream()StringtoString()
-
-
-
Constructor Detail
-
MultiReleaseJarFile
public MultiReleaseJarFile(File file) throws IOException
Construct a multi release jar file for the current JVM version, ignoring directories.- Parameters:
file- The file to open- Throws:
IOException- if the jar file cannot be read
-
MultiReleaseJarFile
public MultiReleaseJarFile(File file, int javaPlatform, boolean includeDirectories) throws IOException
Construct a multi release jar file- Parameters:
file- The file to openjavaPlatform- The JVM platform to apply when selecting a version.includeDirectories- true if any directory entries should not be ignored- Throws:
IOException- if the jar file cannot be read
-
-
Method Detail
-
isMultiRelease
public boolean isMultiRelease()
- Returns:
- true IFF the jar is a multi release jar
-
getVersion
public int getVersion()
- Returns:
- The major version applied to this jar for the purposes of selecting entries
-
stream
public Stream<MultiReleaseJarFile.VersionedJarEntry> stream()
- Returns:
- A stream of versioned entries from the jar, excluded any that are not applicable
-
getEntry
public MultiReleaseJarFile.VersionedJarEntry getEntry(String name)
Get a versioned resource entry by name- Parameters:
name- The unversioned name of the resource- Returns:
- The versioned entry of the resource
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-