Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
JDK 17 jdk.jpackage.jmod - JPackage Tool
JDK 17 jdk.jpackage.jmod is the JMOD file for JDK 17 JPackage tool,
which can be invoked by the "jpackage" command.
JDK 17 JPackage tool compiled class files are stored in \fyicenter\jdk-17.0.5\jmods\jdk.jpackage.jmod.
JDK 17 JPackage tool compiled class files are also linked and stored in the \fyicenter\jdk-17.0.5\lib\modules JImage file.
JDK 17 JPackage tool source code files are stored in \fyicenter\jdk-17.0.5\lib\src.zip\jdk.jpackage.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ jdk/jpackage/internal/PathGroup.java
/* * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package jdk.jpackage.internal; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.function.BiFunction; import java.util.stream.Collectors; import java.util.stream.Stream; /** * Group of paths. * Each path in the group is assigned a unique id. */ final class PathGroup { PathGroup(Map<Object, Path> paths) { entries = new HashMap<>(paths); } Path getPath(Object id) { if (id == null) { throw new NullPointerException(); } return entries.get(id); } void setPath(Object id, Path path) { if (path != null) { entries.put(id, path); } else { entries.remove(id); } } /** * All configured entries. */ List<Path> paths() { return entries.values().stream().toList(); } /** * Root entries. */ List<Path> roots() { // Sort by the number of path components in ascending order. List<Map.Entry<Path, Path>> sorted = normalizedPaths().stream().sorted( (a, b) -> a.getKey().getNameCount() - b.getKey().getNameCount()).toList(); // Returns `true` if `a` is a parent of `b` BiFunction<Map.Entry<Path, Path>, Map.Entry<Path, Path>, Boolean> isParentOrSelf = (a, b) -> { return a == b || b.getKey().startsWith(a.getKey()); }; return sorted.stream().filter( v -> v == sorted.stream().sequential().filter( v2 -> isParentOrSelf.apply(v2, v)).findFirst().get()).map( v -> v.getValue()).toList(); } long sizeInBytes() throws IOException { long reply = 0; for (Path dir : roots().stream().filter(f -> Files.isDirectory(f)).collect( Collectors.toList())) { try (Stream<Path> stream = Files.walk(dir)) { reply += stream.filter(p -> Files.isRegularFile(p)).mapToLong( f -> f.toFile().length()).sum(); } } return reply; } PathGroup resolveAt(Path root) { return new PathGroup(entries.entrySet().stream().collect( Collectors.toMap(e -> e.getKey(), e -> root.resolve(e.getValue())))); } void copy(PathGroup dst) throws IOException { copy(this, dst, null, false); } void move(PathGroup dst) throws IOException { copy(this, dst, null, true); } void transform(PathGroup dst, TransformHandler handler) throws IOException { copy(this, dst, handler, false); } static interface Facade<T> { PathGroup pathGroup(); default Collection<Path> paths() { return pathGroup().paths(); } default List<Path> roots() { return pathGroup().roots(); } default long sizeInBytes() throws IOException { return pathGroup().sizeInBytes(); } T resolveAt(Path root); default void copy(Facade<T> dst) throws IOException { pathGroup().copy(dst.pathGroup()); } default void move(Facade<T> dst) throws IOException { pathGroup().move(dst.pathGroup()); } default void transform(Facade<T> dst, TransformHandler handler) throws IOException { pathGroup().transform(dst.pathGroup(), handler); } } static interface TransformHandler { public void copyFile(Path src, Path dst) throws IOException; public void createDirectory(Path dir) throws IOException; } private static void copy(PathGroup src, PathGroup dst, TransformHandler handler, boolean move) throws IOException { List<Map.Entry<Path, Path>> copyItems = new ArrayList<>(); List<Path> excludeItems = new ArrayList<>(); for (var id: src.entries.keySet()) { Path srcPath = src.entries.get(id); if (dst.entries.containsKey(id)) { copyItems.add(Map.entry(srcPath, dst.entries.get(id))); } else { excludeItems.add(srcPath); } } copy(move, copyItems, excludeItems, handler); } private static void copy(boolean move, List<Map.Entry<Path, Path>> entries, List<Path> excludePaths, TransformHandler handler) throws IOException { if (handler == null) { handler = new TransformHandler() { @Override public void copyFile(Path src, Path dst) throws IOException { Files.createDirectories(IOUtils.getParent(dst)); if (move) { Files.move(src, dst); } else { Files.copy(src, dst); } } @Override public void createDirectory(Path dir) throws IOException { Files.createDirectories(dir); } }; } // destination -> source file mapping Map<Path, Path> actions = new HashMap<>(); for (var action: entries) { Path src = action.getKey(); Path dst = action.getValue(); if (Files.isDirectory(src)) { try (Stream<Path> stream = Files.walk(src)) { stream.sequential().forEach(path -> actions.put(dst.resolve( src.relativize(path)).normalize(), path)); } } else { actions.put(dst.normalize(), src); } } for (var action : actions.entrySet()) { Path dst = action.getKey(); Path src = action.getValue(); if (excludePaths.stream().anyMatch(src::startsWith)) { continue; } if (src.equals(dst) || !src.toFile().exists()) { continue; } if (Files.isDirectory(src)) { handler.createDirectory(dst); } else { handler.copyFile(src, dst); } } if (move) { // Delete source dirs. for (var entry: entries) { Path srcFile = entry.getKey(); if (Files.isDirectory(srcFile)) { IOUtils.deleteRecursive(srcFile); } } } } private static Map.Entry<Path, Path> normalizedPath(Path v) { final Path normalized; if (!v.isAbsolute()) { normalized = Path.of("./").resolve(v.normalize()); } else { normalized = v.normalize(); } return Map.entry(normalized, v); } private List<Map.Entry<Path, Path>> normalizedPaths() { return entries.values().stream().map(PathGroup::normalizedPath).collect( Collectors.toList()); } private final Map<Object, Path> entries; }
⏎ jdk/jpackage/internal/PathGroup.java
Or download all of them as a single archive file:
File name: jdk.jpackage-17.0.5-src.zip File size: 92069 bytes Release date: 2022-09-13 Download
⇒ JDK 17 jdk.jshell.jmod - JShell Tool
2023-08-03, 5236👍, 0💬
Popular Posts:
How to download and install ojdbc5.jar for Oracle 11g R1? ojdbc5.jar for Oracle 11g R1 is a Java 5 J...
The Web Services Description Language for Java Toolkit (WSDL4J), Release 1.6.2, allows the creation,...
How to run "jarsigner" command from JDK tools.jar file? "jarsigner" command allows you to digitally ...
MXP1 is a stable XmlPull parsing engine that is based on ideas from XPP and in particular XPP2 but c...
Apache Log4j Core Implementation provides the functional components of the logging system. Users are...