Skip to content

Commit

Permalink
add delegate methods
Browse files Browse the repository at this point in the history
  • Loading branch information
marschall committed Dec 29, 2023
1 parent 3072a92 commit 2ee814f
Showing 1 changed file with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,8 @@ public void delete(Path path) throws IOException {
@Override
public boolean deleteIfExists(Path path) throws IOException {
AbstractPath abstractPath = castPath(path);
// FIXME
return false;
MemoryFileSystem memoryFileSystem = abstractPath.getMemoryFileSystem();
return memoryFileSystem.deleteIfExists(abstractPath);
}

@Override
Expand Down Expand Up @@ -437,15 +437,11 @@ public void checkAccess(Path path, AccessMode... modes) throws IOException {
}

// new with JDK 20
@Override
// @Override
public boolean exists(Path path, LinkOption... options) {
return false;
}

// new with JDK 20
@Override
public <A extends BasicFileAttributes> A readAttributesIfExists(Path path, Class<A> type, LinkOption... options) throws IOException {
return null;
AbstractPath abstractPath = castPath(path);
MemoryFileSystem memoryFileSystem = abstractPath.getMemoryFileSystem();
return memoryFileSystem.exists(abstractPath, options);
}

@Override
Expand All @@ -462,6 +458,14 @@ public <A extends BasicFileAttributes> A readAttributes(Path path, Class<A> type
return memoryFileSystem.readAttributes(abstractPath, type, options);
}

// new with JDK 20
// @Override
public <A extends BasicFileAttributes> A readAttributesIfExists(Path path, Class<A> type, LinkOption... options) throws IOException {
AbstractPath abstractPath = castPath(path);
MemoryFileSystem memoryFileSystem = abstractPath.getMemoryFileSystem();
return memoryFileSystem.readAttributesIfExists(abstractPath, type, options);
}

@Override
public Map<String, Object> readAttributes(Path path, String attributes, LinkOption... options) throws IOException {
AbstractPath abstractPath = castPath(path);
Expand Down

0 comments on commit 2ee814f

Please sign in to comment.