Top Description Constructors Methods
io.smallrye.common.io.jar

public Class JarFiles

extends Object
Class Inheritance
Imports
java.io.File, .IOException, java.util.jar.JarFile, java.util.zip.ZipFile

Java 9+ variant of a JDK-specific class for working with JarFiles.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static JarFile

Returns:

an equivalent of new JarFile(name)
create
(String
the file name (must not be null)
name
)

Returns an equivalent of new JarFile(name).

public static JarFile

Returns:

an equivalent of new JarFile(name, verify)
create
(String
the file name (must not be null)
name
,
boolean
true to verify the JAR signatures
verify
)

Returns an equivalent of new JarFile(name, verify).

public static JarFile

Returns:

an equivalent of new JarFile(file)
create
(File
the file (must not be null)
file
)

Returns an equivalent of new JarFile(file).

public static JarFile

Returns:

an equivalent of new JarFile(file, verify)
create
(File
the file (must not be null)
file
,
boolean
true to verify the JAR signatures
verify
)

Returns an equivalent of new JarFile(file, verify).

public static boolean

Returns:

true if this JarFile is a multi-release jar
isMultiRelease
(JarFile
the JAR file (must not be null)
jarFile
)

Returns true if this JarFile is a multi-release jar.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

JarFilesback to summary
private JarFiles()

Method Detail

createback to summary
public static JarFile create(String name) throws IOException

Returns an equivalent of new JarFile(name). On Java 8, that's exactly what is returned. On Java 9+, an equivalent that is multi-release-enabled is returned.

Parameters
name:String

the file name (must not be null)

Returns:JarFile

an equivalent of new JarFile(name)

Exceptions
IOException:
if the operation fails
createback to summary
public static JarFile create(String name, boolean verify) throws IOException

Returns an equivalent of new JarFile(name, verify). On Java 8, that's exactly what is returned. On Java 9+, an equivalent that is multi-release-enabled is returned.

Parameters
name:String

the file name (must not be null)

verify:boolean

true to verify the JAR signatures

Returns:JarFile

an equivalent of new JarFile(name, verify)

Exceptions
IOException:
if the operation fails
createback to summary
public static JarFile create(File file) throws IOException

Returns an equivalent of new JarFile(file). On Java 8, that's exactly what is returned. On Java 9+, an equivalent that is multi-release-enabled is returned.

Parameters
file:File

the file (must not be null)

Returns:JarFile

an equivalent of new JarFile(file)

Exceptions
IOException:
if the operation fails
createback to summary
public static JarFile create(File file, boolean verify) throws IOException

Returns an equivalent of new JarFile(file, verify). On Java 8, that's exactly what is returned. On Java 9+, an equivalent that is multi-release-enabled is returned.

Parameters
file:File

the file (must not be null)

verify:boolean

true to verify the JAR signatures

Returns:JarFile

an equivalent of new JarFile(file, verify)

Exceptions
IOException:
if the operation fails
isMultiReleaseback to summary
public static boolean isMultiRelease(JarFile jarFile)

Returns true if this JarFile is a multi-release jar. On Java 8 this is done by browsing the manifest. On Java 9+, there is a isMultiRelease method.

Parameters
jarFile:JarFile

the JAR file (must not be null)

Returns:boolean

true if this JarFile is a multi-release jar