< prev index next >
src/java.base/share/classes/jdk/internal/jrtfs/JrtPath.java
Print this page
*** 53,62 ****
--- 53,66 ----
this.path = path;
else
this.path = normalize(path);
}
+ byte[] getName() {
+ return path;
+ }
+
@Override
public JrtPath getRoot() {
if (this.isAbsolute())
return jrtfs.getRootPath();
else
*** 138,151 ****
--- 142,164 ----
}
@Override
public JrtPath toRealPath(LinkOption... options) throws IOException {
JrtPath realPath = new JrtPath(jrtfs, getResolvedPath()).toAbsolutePath();
+ realPath = JrtFileSystem.followLinks(options)? jrtfs.resolveLink(this) : realPath;
realPath.checkAccess();
return realPath;
}
+ JrtPath readSymbolicLink() throws IOException {
+ if (! jrtfs.isLink(this)) {
+ throw new IOException("not a symbolic link");
+ }
+
+ return jrtfs.resolveLink(this);
+ }
+
boolean isHidden() {
return false;
}
@Override
*** 636,648 ****
void deleteIfExists() throws IOException {
jrtfs.deleteFile(getResolvedPath(), false);
}
! JrtFileAttributes getAttributes() throws IOException
{
! JrtFileAttributes zfas = jrtfs.getFileAttributes(getResolvedPath());
if (zfas == null)
throw new NoSuchFileException(toString());
return zfas;
}
--- 649,661 ----
void deleteIfExists() throws IOException {
jrtfs.deleteFile(getResolvedPath(), false);
}
! JrtFileAttributes getAttributes(LinkOption... options) throws IOException
{
! JrtFileAttributes zfas = jrtfs.getFileAttributes(getResolvedPath(), options);
if (zfas == null)
throw new NoSuchFileException(toString());
return zfas;
}
*** 657,667 ****
attr = attribute;
} else {
type = attribute.substring(0, colonPos++);
attr = attribute.substring(colonPos);
}
! JrtFileAttributeView view = JrtFileAttributeView.get(this, type);
if (view == null)
throw new UnsupportedOperationException("view <" + view + "> is not supported");
view.setAttribute(attr, value);
}
--- 670,680 ----
attr = attribute;
} else {
type = attribute.substring(0, colonPos++);
attr = attribute.substring(colonPos);
}
! JrtFileAttributeView view = JrtFileAttributeView.get(this, type, options);
if (view == null)
throw new UnsupportedOperationException("view <" + view + "> is not supported");
view.setAttribute(attr, value);
}
*** 683,693 ****
attrs = attributes;
} else {
view = attributes.substring(0, colonPos++);
attrs = attributes.substring(colonPos);
}
! JrtFileAttributeView jrtfv = JrtFileAttributeView.get(this, view);
if (jrtfv == null) {
throw new UnsupportedOperationException("view not supported");
}
return jrtfv.readAttributes(attrs);
}
--- 696,706 ----
attrs = attributes;
} else {
view = attributes.substring(0, colonPos++);
attrs = attributes.substring(colonPos);
}
! JrtFileAttributeView jrtfv = JrtFileAttributeView.get(this, view, options);
if (jrtfv == null) {
throw new UnsupportedOperationException("view not supported");
}
return jrtfv.readAttributes(attrs);
}
*** 704,716 ****
return true;
if (other == null ||
this.getFileSystem() != other.getFileSystem())
return false;
this.checkAccess();
! ((JrtPath)other).checkAccess();
! return Arrays.equals(this.getResolvedPath(),
! ((JrtPath)other).getResolvedPath());
}
SeekableByteChannel newByteChannel(Set<? extends OpenOption> options,
FileAttribute<?>... attrs)
throws IOException
--- 717,730 ----
return true;
if (other == null ||
this.getFileSystem() != other.getFileSystem())
return false;
this.checkAccess();
! JrtPath path = (JrtPath)other;
! path.checkAccess();
! return Arrays.equals(this.getResolvedPath(), path.getResolvedPath()) ||
! jrtfs.isSameFile(this, (JrtPath)other);
}
SeekableByteChannel newByteChannel(Set<? extends OpenOption> options,
FileAttribute<?>... attrs)
throws IOException
< prev index next >