Modifier and Type | Method and Description |
---|---|
static Path |
extract(Path path,
IndexRangeNegative range)
Extracts a sub-path from a
Path by only retaining a range of elements. |
public static Path extract(Path path, IndexRangeNegative range) throws DerivePathException
Path
by only retaining a range of elements.
The name-elements are a split of the Path
by the directory-separator. See the
Path
Javadoc.
All indices begin at 0 (for the first element), and can also accept negative-indices which count backwards from the end.
e.g. -1 is the last element; -2 is the second-last element.
path
- the path to find a sub-path for.range
- which elements to include or not.Path
containing only the elements of path
in the
sub-range.DerivePathException
- if the range contains invalid indices.Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.