private Path emptyPath() { return newPath(fs, "", host, isRealPath, true); }
private Path emptyPath() { return newPath(fs, "", host, isRealPath, true); }
@Override public Path normalize() { if (isNormalized) { return this; } return newPath(fs, FilenameUtils.normalize(new String(path), !usesWindowsFormat), host, isRealPath, true); }
@Override public Path normalize() { if (isNormalized) { return this; } return newPath(fs, FilenameUtils.normalize(new String(path), !usesWindowsFormat), host, isRealPath, true); }
@Override public Path getName(int index) throws IllegalArgumentException { if (isRoot && index > 0) { throw new IllegalArgumentException("Invalid index argument: " + index); } if (index < 0) { throw new IllegalArgumentException("Invalid index argument: " + index); } if (index >= offsets.size()) { throw new IllegalArgumentException("Invalid index argument: " + index + ", max allowed is " + (offsets.size() - 1)); } return newPath(fs, substring(index), host, isRealPath, false); }
@Override public Path getName(int index) throws IllegalArgumentException { if (isRoot && index > 0) { throw new IllegalArgumentException("Invalid index argument: " + index); } if (index < 0) { throw new IllegalArgumentException("Invalid index argument: " + index); } if (index >= offsets.size()) { throw new IllegalArgumentException("Invalid index argument: " + index + ", max allowed is " + (offsets.size() - 1)); } return newPath(fs, substring(index), host, isRealPath, false); }
@Override public Path subpath(int beginIndex, int endIndex) throws IllegalArgumentException { if (beginIndex < 0) { throw new IllegalArgumentException("Invalid beginIndex argument: " + beginIndex); } if (beginIndex >= offsets.size()) { throw new IllegalArgumentException("Invalid beginIndex argument: " + beginIndex); } if (endIndex > offsets.size()) { throw new IllegalArgumentException("Invalid endIndex argument: " + endIndex); } if (beginIndex >= endIndex) { throw new IllegalArgumentException("Invalid arguments, beginIndex must be < endIndex, but they were: " + "bI " + beginIndex + ", eI " + endIndex); } return newPath(fs, substring(beginIndex, endIndex - 1), host, isRealPath, false); }
@Override public Path subpath(int beginIndex, int endIndex) throws IllegalArgumentException { if (beginIndex < 0) { throw new IllegalArgumentException("Invalid beginIndex argument: " + beginIndex); } if (beginIndex >= offsets.size()) { throw new IllegalArgumentException("Invalid beginIndex argument: " + beginIndex); } if (endIndex > offsets.size()) { throw new IllegalArgumentException("Invalid endIndex argument: " + endIndex); } if (beginIndex >= endIndex) { throw new IllegalArgumentException("Invalid arguments, beginIndex must be < endIndex, but they were: " + "bI " + beginIndex + ", eI " + endIndex); } return newPath(fs, substring(beginIndex, endIndex - 1), host, isRealPath, false); }
@Override public Path toRealPath(final LinkOption... options) throws IOException, SecurityException { if (isRealPath) { return this; } return newPath(fs, FilenameUtils.normalize(toString(), !usesWindowsFormat), host, true, true); }
@Override public Path resolveSibling(final String other) throws InvalidPathException { checkNotNull("other", other); return resolveSibling(newPath(fs, other, host, isRealPath, false)); }
@Override public Path resolve(final String other) throws InvalidPathException { checkNotNull("other", other); return resolve(newPath(fs, other, host, isRealPath, false)); }
@Override public Path resolve(final String other) throws InvalidPathException { checkNotNull("other", other); return resolve(newPath(fs, other, host, isRealPath, false)); }
@Override public Path resolveSibling(final String other) throws InvalidPathException { checkNotNull("other", other); return resolveSibling(newPath(fs, other, host, isRealPath, false)); }
@Override public Path resolve(final Path other) { checkNotNull("other", other); if (other.isAbsolute()) { return other; } if (other.toString().trim().length() == 0) { return this; } final StringBuilder sb = new StringBuilder(); sb.append(new String(path)); if (path[path.length - 1] != getSeparator()) { sb.append(getSeparator()); } sb.append(other.toString()); return newPath(fs, sb.toString(), host, isRealPath, false); }
@Override public Path toRealPath(final LinkOption... options) throws IOException, SecurityException { if (isRealPath) { return this; } return newPath(fs, FilenameUtils.normalize(toString(), !usesWindowsFormat), host, true, true); }
@Override public Path resolve(final Path other) { checkNotNull("other", other); if (other.isAbsolute()) { return other; } if (other.toString().trim().length() == 0) { return this; } final StringBuilder sb = new StringBuilder(); sb.append(new String(path)); if (path[path.length - 1] != getSeparator()) { sb.append(getSeparator()); } sb.append(other.toString()); return newPath(fs, sb.toString(), host, isRealPath, false); }
@Override public Path toAbsolutePath() throws IOException, SecurityException { if (isAbsolute()) { return this; } if (host.isEmpty()) { return newPath(fs, FilenameUtils.normalize(defaultDirectory() + toString(), !usesWindowsFormat), host, isRealPath, true); } return newPath(fs, defaultDirectory() + toString(false), host, isRealPath, true); }
@Override public Path toAbsolutePath() throws IOException, SecurityException { if (isAbsolute()) { return this; } if (host.isEmpty()) { return newPath(fs, FilenameUtils.normalize(defaultDirectory() + toString(), !usesWindowsFormat), host, isRealPath, true); } return newPath(fs, defaultDirectory() + toString(false), host, isRealPath, true); }
@Override public Path getParent() { if (getNameCount() <= 0) { return null; } if (getNameCount() == 1) { return getRoot(); } return newPath(fs, substring(-1, getNameCount() - 2), host, isRealPath, isNormalized); }
@Override public Path getParent() { if (getNameCount() <= 0) { return null; } if (getNameCount() == 1) { return getRoot(); } return newPath(fs, substring(-1, getNameCount() - 2), host, isRealPath, isNormalized); }