8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /**
25 * @test
26 * @modules java.base/jdk.internal.module
27 * @library /test/lib
28 * @build ModuleFinderTest jdk.test.lib.util.ModuleInfoWriter
29 * @run testng ModuleFinderTest
30 * @summary Basic tests for java.lang.module.ModuleFinder
31 */
32
33 import java.io.File;
34 import java.io.OutputStream;
35 import java.lang.module.FindException;
36 import java.lang.module.InvalidModuleDescriptorException;
37 import java.lang.module.ModuleDescriptor;
38 import java.lang.module.ModuleFinder;
39 import java.lang.module.ModuleReference;
40 import java.nio.file.Files;
41 import java.nio.file.Path;
42 import java.nio.file.Paths;
43 import java.util.Optional;
44 import java.util.Set;
45 import java.util.jar.JarEntry;
46 import java.util.jar.JarOutputStream;
47 import java.util.stream.Collectors;
48
809 try (OutputStream out = Files.newOutputStream(file)) {
810 try (JarOutputStream jos = new JarOutputStream(out)) {
811
812 JarEntry je = new JarEntry("module-info.class");
813 jos.putNextEntry(je);
814 ModuleInfoWriter.write(descriptor, jos);
815 jos.closeEntry();
816
817 for (String entry : entries) {
818 je = new JarEntry(entry);
819 jos.putNextEntry(je);
820 jos.closeEntry();
821 }
822 }
823
824 }
825 return file;
826 }
827
828 }
829
|
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /**
25 * @test
26 * @modules java.base/jdk.internal.module
27 * @library /test/lib
28 * @build ModuleFinderTest
29 * @run testng ModuleFinderTest
30 * @summary Basic tests for java.lang.module.ModuleFinder
31 */
32
33 import java.io.File;
34 import java.io.OutputStream;
35 import java.lang.module.FindException;
36 import java.lang.module.InvalidModuleDescriptorException;
37 import java.lang.module.ModuleDescriptor;
38 import java.lang.module.ModuleFinder;
39 import java.lang.module.ModuleReference;
40 import java.nio.file.Files;
41 import java.nio.file.Path;
42 import java.nio.file.Paths;
43 import java.util.Optional;
44 import java.util.Set;
45 import java.util.jar.JarEntry;
46 import java.util.jar.JarOutputStream;
47 import java.util.stream.Collectors;
48
809 try (OutputStream out = Files.newOutputStream(file)) {
810 try (JarOutputStream jos = new JarOutputStream(out)) {
811
812 JarEntry je = new JarEntry("module-info.class");
813 jos.putNextEntry(je);
814 ModuleInfoWriter.write(descriptor, jos);
815 jos.closeEntry();
816
817 for (String entry : entries) {
818 je = new JarEntry(entry);
819 jos.putNextEntry(je);
820 jos.closeEntry();
821 }
822 }
823
824 }
825 return file;
826 }
827
828 }
|