Class PathGroup
java.lang.Object
jdk.jpackage.internal.util.PathGroup
Group of paths. Each path in the group is assigned a unique id.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Handler of file copying and directory creating. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
copy
(PathGroup dst, CopyOption... options) Copies files/directories from the locations in the path group into the locations of the given path group.Returns a path associated with the given identifier in this path group.void
Adds a path associated with the new unique identifier to this path group.keys()
Gets all identifiers of this path group.void
move
(PathGroup dst, CopyOption... options) Similar tocopy(PathGroup, CopyOption...)
but moves files/directories instead of copying.paths()
Gets paths associated with all identifiers in this path group.Creates a copy of this path group with all paths resolved against the given root.roots()
Gets root paths in this path group.void
Assigns the specified path value to the given identifier in this path group.long
Gets the number of bytes in root paths of this path group.void
transform
(PathGroup dst, PathGroup.TransformHandler handler) Similar tocopy(PathGroup, CopyOption...)
but uses the given handler to transform paths instead of coping.
-
Constructor Details
-
PathGroup
-
-
Method Details
-
getPath
-
setPath
Assigns the specified path value to the given identifier in this path group. If the given identifier doesn't exist in this path group, it is added, otherwise, the current value associated with the identifier is replaced with the given path value. If the path value isnull
the given identifier is removed from this path group if it existed; otherwise, no action is taken.- Parameters:
id
- the identifierpath
- the path to associate with the identifier ornull
-
ghostPath
Adds a path associated with the new unique identifier to this path group.- Parameters:
path
- the path to associate the new unique identifier in this path group
-
keys
-
paths
-
roots
Gets root paths in this path group.If multiple identifiers are associated with the same path value in the group, the path value is added to the returned list only once. Paths that are descendants of other paths in the group are not added to the returned list.
The order of paths in the returned list is undefined.
- Returns:
- unique root paths in this path group
-
sizeInBytes
Gets the number of bytes in root paths of this path group. The method sums the size of all root path entries in the group. If the path entry is a directory it calculates the total size of the files in the directory. If the path entry is a file, it takes its size.- Returns:
- the total number of bytes in root paths of this path group
- Throws:
IOException
- If an I/O error occurs
-
resolveAt
Creates a copy of this path group with all paths resolved against the given root. Taken action is equivalent to creating a copy of this path group and callingroot.resolve()
on every path in the copy.- Parameters:
root
- the root against which to resolve paths- Returns:
- a new path group resolved against the given root path
-
copy
Copies files/directories from the locations in the path group into the locations of the given path group. For every identifier found in this and the given group, copy the associated file or directory from the location specified by the path value associated with the identifier in this group into the location associated with the identifier in the given group.- Parameters:
dst
- the destination path group- Throws:
IOException
- If an I/O error occurs
-
move
Similar tocopy(PathGroup, CopyOption...)
but moves files/directories instead of copying.- Parameters:
dst
- the destination path group- Throws:
IOException
- If an I/O error occurs
-
transform
Similar tocopy(PathGroup, CopyOption...)
but uses the given handler to transform paths instead of coping.- Parameters:
dst
- the destination path grouphandler
- the path transformation handler- Throws:
IOException
- If an I/O error occurs
-