34 import java.lang.module.ModuleFinder;
35 import java.lang.module.ModuleReference;
36 import java.lang.reflect.Method;
37 import java.net.URI;
38 import java.nio.file.Path;
39 import java.nio.file.Files;
40 import java.nio.file.Paths;
41 import java.util.*;
42 import java.util.function.Consumer;
43 import java.util.regex.Matcher;
44 import java.util.regex.Pattern;
45 import java.util.stream.Collectors;
46 import java.util.zip.*;
47 import java.util.jar.*;
48 import java.util.jar.Pack200.*;
49 import java.util.jar.Manifest;
50 import java.text.MessageFormat;
51
52 import jdk.internal.module.Hasher;
53 import jdk.internal.module.ModuleInfoExtender;
54 import sun.misc.JarIndex;
55 import static sun.misc.JarIndex.INDEX_NAME;
56 import static java.util.jar.JarFile.MANIFEST_NAME;
57 import static java.util.stream.Collectors.joining;
58 import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
59
60 /**
61 * This class implements a simple utility for creating files in the JAR
62 * (Java Archive) file format. The JAR format is based on the ZIP file
63 * format, with optional meta-information stored in a MANIFEST entry.
64 */
65 public
66 class Main {
67 String program;
68 PrintStream out, err;
69 String fname, mname, ename;
70 String zname = "";
71 String[] files;
72 String rootjar = null;
73
74 // An entryName(path)->File map generated during "expand", it helps to
75 // decide whether or not an existing entry in a jar file needs to be
|
34 import java.lang.module.ModuleFinder;
35 import java.lang.module.ModuleReference;
36 import java.lang.reflect.Method;
37 import java.net.URI;
38 import java.nio.file.Path;
39 import java.nio.file.Files;
40 import java.nio.file.Paths;
41 import java.util.*;
42 import java.util.function.Consumer;
43 import java.util.regex.Matcher;
44 import java.util.regex.Pattern;
45 import java.util.stream.Collectors;
46 import java.util.zip.*;
47 import java.util.jar.*;
48 import java.util.jar.Pack200.*;
49 import java.util.jar.Manifest;
50 import java.text.MessageFormat;
51
52 import jdk.internal.module.Hasher;
53 import jdk.internal.module.ModuleInfoExtender;
54 import jdk.internal.util.jar.JarIndex;
55 import static jdk.internal.util.jar.JarIndex.INDEX_NAME;
56 import static java.util.jar.JarFile.MANIFEST_NAME;
57 import static java.util.stream.Collectors.joining;
58 import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
59
60 /**
61 * This class implements a simple utility for creating files in the JAR
62 * (Java Archive) file format. The JAR format is based on the ZIP file
63 * format, with optional meta-information stored in a MANIFEST entry.
64 */
65 public
66 class Main {
67 String program;
68 PrintStream out, err;
69 String fname, mname, ename;
70 String zname = "";
71 String[] files;
72 String rootjar = null;
73
74 // An entryName(path)->File map generated during "expand", it helps to
75 // decide whether or not an existing entry in a jar file needs to be
|