Class JarUtils

java.lang.Object
org.elasticsearch.test.jar.JarUtils

public final class JarUtils extends Object
  • 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 created
      name - the name of the jar file
      manifest - the manifest, may be null
      files - 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 IOException
      Creates a jar file with the given entries.
      Parameters:
      jarfile - the jar file path
      entries - 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 IOException
      Creates a jar file with the given entries. Entry values are converted to bytes using UTF-8.
      Parameters:
      jarfile - the jar file path
      entries - map of entries to add; jar entry name to String contents
      Throws:
      IOException - if an I/O error occurs