70 * }</pre>
71 */
72 public final class ImageFileCreator {
73 private final Map<String, List<Entry>> entriesForModule = new HashMap<>();
74 private final ImagePluginStack plugins;
75 private ImageFileCreator(ImagePluginStack plugins) {
76 this.plugins = plugins;
77 }
78
79 public static ExecutableImage create(Set<Archive> archives,
80 ImagePluginStack plugins)
81 throws IOException {
82 return ImageFileCreator.create(archives, ByteOrder.nativeOrder(),
83 plugins);
84 }
85
86 public static ExecutableImage create(Set<Archive> archives,
87 ByteOrder byteOrder)
88 throws IOException {
89 return ImageFileCreator.create(archives, byteOrder,
90 new ImagePluginStack(null));
91 }
92
93 public static ExecutableImage create(Set<Archive> archives,
94 ByteOrder byteOrder,
95 ImagePluginStack plugins)
96 throws IOException
97 {
98 ImageFileCreator image = new ImageFileCreator(plugins);
99 try {
100 image.readAllEntries(archives);
101 // write to modular image
102 image.writeImage(archives, byteOrder);
103 } finally {
104 //Close all archives
105 for (Archive a : archives) {
106 a.close();
107 }
108 }
109
110 return plugins.getExecutableImage();
|
70 * }</pre>
71 */
72 public final class ImageFileCreator {
73 private final Map<String, List<Entry>> entriesForModule = new HashMap<>();
74 private final ImagePluginStack plugins;
75 private ImageFileCreator(ImagePluginStack plugins) {
76 this.plugins = plugins;
77 }
78
79 public static ExecutableImage create(Set<Archive> archives,
80 ImagePluginStack plugins)
81 throws IOException {
82 return ImageFileCreator.create(archives, ByteOrder.nativeOrder(),
83 plugins);
84 }
85
86 public static ExecutableImage create(Set<Archive> archives,
87 ByteOrder byteOrder)
88 throws IOException {
89 return ImageFileCreator.create(archives, byteOrder,
90 new ImagePluginStack());
91 }
92
93 public static ExecutableImage create(Set<Archive> archives,
94 ByteOrder byteOrder,
95 ImagePluginStack plugins)
96 throws IOException
97 {
98 ImageFileCreator image = new ImageFileCreator(plugins);
99 try {
100 image.readAllEntries(archives);
101 // write to modular image
102 image.writeImage(archives, byteOrder);
103 } finally {
104 //Close all archives
105 for (Archive a : archives) {
106 a.close();
107 }
108 }
109
110 return plugins.getExecutableImage();
|