/** * Creates a copy of the given file, copying its attributes as well according to the given * {@code attributeCopyOption}. */ File copyWithoutContent(File file, AttributeCopyOption attributeCopyOption) throws IOException { File copy = factory.copyWithoutContent(file); setInitialAttributes(copy); attributes.copyAttributes(file, copy, attributeCopyOption); return copy; }
/** * Creates the default view of the file system using the given working directory. */ private static FileSystemView createDefaultView( Configuration config, JimfsFileStore fileStore, PathService pathService) throws IOException { JimfsPath workingDirPath = pathService.parsePath(config.workingDirectory); Directory dir = fileStore.getRoot(workingDirPath.root()); if (dir == null) { throw new IllegalArgumentException("Invalid working dir path: " + workingDirPath); } for (Name name : workingDirPath.names()) { Directory newDir = fileStore.directoryCreator().get(); fileStore.setInitialAttributes(newDir); dir.link(name, newDir); dir = newDir; } return new FileSystemView(fileStore, dir, workingDirPath); } }
store.setInitialAttributes(newFile, attrs); parent.link(path.name(), newFile); parent.updateModifiedTime();
/** * Creates a copy of the given file, copying its attributes as well according to the given * {@code attributeCopyOption}. */ File copyWithoutContent(File file, AttributeCopyOption attributeCopyOption) throws IOException { File copy = factory.copyWithoutContent(file); setInitialAttributes(copy); attributes.copyAttributes(file, copy, attributeCopyOption); return copy; }
/** * Creates the default view of the file system using the given working directory. */ private static FileSystemView createDefaultView( Configuration config, JimfsFileStore fileStore, PathService pathService) throws IOException { JimfsPath workingDirPath = pathService.parsePath(config.workingDirectory); Directory dir = fileStore.getRoot(workingDirPath.root()); if (dir == null) { throw new IllegalArgumentException("Invalid working dir path: " + workingDirPath); } for (Name name : workingDirPath.names()) { Directory newDir = fileStore.directoryCreator().get(); fileStore.setInitialAttributes(newDir); dir.link(name, newDir); dir = newDir; } return new FileSystemView(fileStore, dir, workingDirPath); } }
store.setInitialAttributes(newFile, attrs); parent.link(path.name(), newFile); parent.updateModifiedTime();