public abstract Path subpath (int beginIndex, int endIndex)

Returns a relative Path that is a subsequence of the name elements of this path.

The beginIndex and endIndex parameters specify the subsequence of name elements. The name that is closest to the root in the directory hierarchy has index 0. The name that is farthest from the root has index count -1. The returned Path object has the name elements that begin at beginIndex and extend to the element at index endIndex-1.

Parameters:
beginIndex     the index of the first element, inclusive
endIndex     the index of the last element, exclusive

Returns:  a new Path object that is a subsequence of the name elements in this Path

Exceptions:
IllegalArgumentException     if beginIndex is negative, or greater than or equal to the number of elements. If endIndex is less than or equal to beginIndex, or larger than the number of elements.