public final class

JarUtils

extends Object
java.lang.Object
   ↳ com.atlassian.plugin.osgi.factory.transform.JarUtils

Class Overview

Utility methods for getting stuff out of a jar.

Summary

Nested Classes
interface JarUtils.Extractor<T>  
Public Methods
static void closeQuietly(JarFile jarFile)
Quietly close jar file.
static <T> T withJar(File file, Extractor<T> extractor)
Extract something from a jar file.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static void closeQuietly (JarFile jarFile)

Quietly close jar file.

Parameters
jarFile the file to close.

public static T withJar (File file, Extractor<T> extractor)

Extract something from a jar file.

Correctly opens and closes the Jar file. Must not lazily access the Jar as it has an open/closed state.

Parameters
file the file that is the jar contents
Returns
  • the result of the extractor
Throws
RuntimeException if there are problems accessing the jar contents.