Package org.elasticsearch.test.jar
Class JarUtils
java.lang.Object
org.elasticsearch.test.jar.JarUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic Path
Creates a jar file with the given manifest and list of (empty) jar file entry names.static void
createJarWithEntries
(Path jarfile, Map<String, byte[]> entries) Creates a jar file with the given entries.static void
createJarWithEntriesUTF
(Path jarfile, Map<String, String> entries) Creates a jar file with the given entries.
-
Method Details
-
createJar
public static Path createJar(Path dir, String name, Manifest manifest, String... files) throws IOException Creates a jar file with the given manifest and list of (empty) jar file entry names. The jar file entries will be added to the jar, but will all be empty (no contents).- Parameters:
dir
- the directory in which the jar will be createdname
- the name of the jar filemanifest
- the manifest, may be nullfiles
- the list of jar entry names, to be added to the jar- Returns:
- the path of the jar file
- Throws:
IOException
- if an I/O error occurs
-
createJarWithEntries
public static void createJarWithEntries(Path jarfile, Map<String, byte[]> entries) throws IOExceptionCreates a jar file with the given entries.- Parameters:
jarfile
- the jar file pathentries
- map of entries to add; jar entry name to byte contents- Throws:
IOException
- if an I/O error occurs
-
createJarWithEntriesUTF
public static void createJarWithEntriesUTF(Path jarfile, Map<String, String> entries) throws IOExceptionCreates a jar file with the given entries. Entry values are converted to bytes using UTF-8.- Parameters:
jarfile
- the jar file pathentries
- map of entries to add; jar entry name to String contents- Throws:
IOException
- if an I/O error occurs
-