- @Override
- public Path getFileName() {
- if (path == null)
- return null;
- return new JcrPath(fs, path[path.length - 1]);
- }
-
- @Override
- public Path getParent() {
- if (path == null)
- return null;
- if (path.length == 1)// root
- return new JcrPath(fs, separator);
- String[] parentPath = Arrays.copyOfRange(path, 0, path.length - 1);
- if (!absolute)
- return new JcrPath(fs, null, parentPath, absolute);
- else
- return new JcrPath(fs, toFsPath(parentPath));
- }
-
- @Override
- public int getNameCount() {
- if (path == null)
- return 0;
- return path.length;
- }
-
- @Override
- public Path getName(int index) {
- if (path == null)
- return null;
- return new JcrPath(fs, path[index]);
- }
-
- @Override
- public Path subpath(int beginIndex, int endIndex) {
- if (path == null)
- return null;
- String[] parentPath = Arrays.copyOfRange(path, beginIndex, endIndex);
- return new JcrPath(fs, null, parentPath, false);
- }
-
- @Override
- public boolean startsWith(Path other) {
- return toString().startsWith(other.toString());
- }
-
- @Override
- public boolean startsWith(String other) {
- return toString().startsWith(other);
- }
-
- @Override
- public boolean endsWith(Path other) {
- return toString().endsWith(other.toString());
- }
-
- @Override
- public boolean endsWith(String other) {
- return toString().endsWith(other);
- }
-
- @Override
- public Path normalize() {
- // always normalized
- return this;
- }
-
- @Override
- public Path resolve(Path other) {
- JcrPath otherPath = (JcrPath) other;
- if (otherPath.isAbsolute())
- return other;
- String[] newPath;
- if (path == null) {
- newPath = new String[otherPath.path.length];
- System.arraycopy(otherPath.path, 0, newPath, 0, otherPath.path.length);
- } else {
- newPath = new String[path.length + otherPath.path.length];
- System.arraycopy(path, 0, newPath, 0, path.length);
- System.arraycopy(otherPath.path, 0, newPath, path.length, otherPath.path.length);
- }
- if (!absolute)
- return new JcrPath(fs, null, newPath, absolute);
- else {
- return new JcrPath(fs, toFsPath(newPath));
- }
- }
-
- @Override
- public final Path resolve(String other) {
- return resolve(getFileSystem().getPath(other));
- }
-
- @Override
- public final Path resolveSibling(Path other) {
- if (other == null)
- throw new NullPointerException();
- Path parent = getParent();
- return (parent == null) ? other : parent.resolve(other);
- }
-
- @Override
- public final Path resolveSibling(String other) {
- return resolveSibling(getFileSystem().getPath(other));
- }
-
- @Override
- public final Iterator<Path> iterator() {
- return new Iterator<Path>() {
- private int i = 0;
-
- @Override
- public boolean hasNext() {
- return (i < getNameCount());
- }
-
- @Override
- public Path next() {
- if (i < getNameCount()) {
- Path result = getName(i);
- i++;
- return result;
- } else {
- throw new NoSuchElementException();
- }
- }
-
- @Override
- public void remove() {
- throw new UnsupportedOperationException();
- }
- };
- }
-
- @Override
- public Path relativize(Path other) {
- if (equals(other))
- return new JcrPath(fs, "");
- if (other.startsWith(this)) {
- String p1 = toString();
- String p2 = other.toString();
- String relative = p2.substring(p1.length(), p2.length());
- if (relative.charAt(0) == '/')
- relative = relative.substring(1);
- return new JcrPath(fs, relative);
- }
- throw new IllegalArgumentException(other + " cannot be relativized against " + this);
- }
-
- @Override
- public URI toUri() {
- try {
- return new URI(fs.provider().getScheme(), toString(), null);
- } catch (URISyntaxException e) {
- throw new JcrFsException("Cannot create URI for " + toString(), e);
- }
- }
-
- @Override
- public Path toAbsolutePath() {
- if (isAbsolute())
- return this;
- return new JcrPath(fs, fileStore, path, true);
- }
-
- @Override
- public Path toRealPath(LinkOption... options) throws IOException {
- return this;
- }
-
- @Override
- public File toFile() {
- throw new UnsupportedOperationException();
- }
+// @Override
+// public Path getFileName() {
+// if (path == null)
+// return null;
+// return new JcrPath(fs, path[path.length - 1]);
+// }
+//
+// @Override
+// public Path getParent() {
+// if (path == null)
+// return null;
+// if (path.length == 1)// root
+// return new JcrPath(fs, separator);
+// String[] parentPath = Arrays.copyOfRange(path, 0, path.length - 1);
+// if (!absolute)
+// return new JcrPath(fs, null, parentPath, absolute);
+// else
+// return new JcrPath(fs, toFsPath(parentPath));
+// }
+//
+// @Override
+// public int getNameCount() {
+// if (path == null)
+// return 0;
+// return path.length;
+// }
+//
+// @Override
+// public Path getName(int index) {
+// if (path == null)
+// return null;
+// return new JcrPath(fs, path[index]);
+// }
+//
+// @Override
+// public Path subpath(int beginIndex, int endIndex) {
+// if (path == null)
+// return null;
+// String[] parentPath = Arrays.copyOfRange(path, beginIndex, endIndex);
+// return new JcrPath(fs, null, parentPath, false);
+// }
+//
+// @Override
+// public boolean startsWith(Path other) {
+// return toString().startsWith(other.toString());
+// }
+//
+// @Override
+// public boolean startsWith(String other) {
+// return toString().startsWith(other);
+// }
+//
+// @Override
+// public boolean endsWith(Path other) {
+// return toString().endsWith(other.toString());
+// }
+//
+// @Override
+// public boolean endsWith(String other) {
+// return toString().endsWith(other);
+// }