/** * Check if a file is a symbolic link and read it * * @param path * a {@link java.io.File} object. * @return target of link or null * @throws java.io.IOException * @since 3.0 */ public String readSymLink(File path) throws IOException { return FileUtils.readSymLink(path); }
/** * @param fs * @param file * @return non null attributes object */ static Attributes getFileAttributesBasic(FS fs, File file) { try { Path nioPath = toPath(file); BasicFileAttributes readAttributes = nioPath .getFileSystem() .provider() .getFileAttributeView(nioPath, BasicFileAttributeView.class, LinkOption.NOFOLLOW_LINKS).readAttributes(); Attributes attributes = new Attributes(fs, file, true, readAttributes.isDirectory(), fs.supportsExecute() ? file.canExecute() : false, readAttributes.isSymbolicLink(), readAttributes.isRegularFile(), // readAttributes.creationTime().toMillis(), // readAttributes.lastModifiedTime().toMillis(), readAttributes.isSymbolicLink() ? Constants .encode(readSymLink(file)).length : readAttributes.size()); return attributes; } catch (IOException e) { return new Attributes(file, fs); } }
/** * Check if a file is a symbolic link and read it * * @param path * @return target of link or null * @throws IOException * @since 3.0 */ public String readSymLink(File path) throws IOException { return FileUtils.readSymLink(path); }
/** * Check if a file is a symbolic link and read it * * @param path * a {@link java.io.File} object. * @return target of link or null * @throws java.io.IOException * @since 3.0 */ public String readSymLink(File path) throws IOException { return FileUtils.readSymLink(path); }
/** * @param path * @return target path of the symlink * @throws IOException * @deprecated use {@link FileUtils#readSymLink(File)} instead */ @Deprecated public static String readSymlink(File path) throws IOException { return FileUtils.readSymLink(path); }
static Attributes getFileAttributesBasic(FS fs, File path) { try { Path nioPath = path.toPath(); BasicFileAttributes readAttributes = nioPath .getFileSystem() .provider() .getFileAttributeView(nioPath, BasicFileAttributeView.class, LinkOption.NOFOLLOW_LINKS).readAttributes(); Attributes attributes = new FileUtil.Java7BasicAttributes(fs, path, true, readAttributes.isDirectory(), fs.supportsExecute() ? path.canExecute() : false, readAttributes.isSymbolicLink(), readAttributes.isRegularFile(), // readAttributes.creationTime().toMillis(), // readAttributes.lastModifiedTime().toMillis(), readAttributes.isSymbolicLink() ? Constants .encode(FileUtils.readSymLink(path)).length : readAttributes.size()); return attributes; } catch (NoSuchFileException e) { return new FileUtil.Java7BasicAttributes(fs, path, false, false, false, false, false, 0L, 0L, 0L); } catch (IOException e) { return new Attributes(path, fs); } }
/** * @param fs * @param file * @return non null attributes object */ static Attributes getFileAttributesBasic(FS fs, File file) { try { Path nioPath = file.toPath(); BasicFileAttributes readAttributes = nioPath .getFileSystem() .provider() .getFileAttributeView(nioPath, BasicFileAttributeView.class, LinkOption.NOFOLLOW_LINKS).readAttributes(); Attributes attributes = new Attributes(fs, file, true, readAttributes.isDirectory(), fs.supportsExecute() ? file.canExecute() : false, readAttributes.isSymbolicLink(), readAttributes.isRegularFile(), // readAttributes.creationTime().toMillis(), // readAttributes.lastModifiedTime().toMillis(), readAttributes.isSymbolicLink() ? Constants .encode(readSymLink(file)).length : readAttributes.size()); return attributes; } catch (IOException e) { return new Attributes(file, fs); } }
static Attributes getFileAttributesBasic(FS fs, File path) { try { Path nioPath = path.toPath(); BasicFileAttributes readAttributes = nioPath .getFileSystem() .provider() .getFileAttributeView(nioPath, BasicFileAttributeView.class, LinkOption.NOFOLLOW_LINKS).readAttributes(); Attributes attributes = new FileUtil.Java7BasicAttributes(fs, path, true, readAttributes.isDirectory(), fs.supportsExecute() ? path.canExecute() : false, readAttributes.isSymbolicLink(), readAttributes.isRegularFile(), // readAttributes.creationTime().toMillis(), // readAttributes.lastModifiedTime().toMillis(), readAttributes.isSymbolicLink() ? Constants .encode(FileUtils.readSymLink(path)).length : readAttributes.size()); return attributes; } catch (NoSuchFileException e) { return new FileUtil.Java7BasicAttributes(fs, path, false, false, false, false, false, 0L, 0L, 0L); } catch (IOException e) { return new Attributes(path, fs); } }
/** * @param fs * @param file * @return non null attributes object */ static Attributes getFileAttributesBasic(FS fs, File file) { try { Path nioPath = toPath(file); BasicFileAttributes readAttributes = nioPath .getFileSystem() .provider() .getFileAttributeView(nioPath, BasicFileAttributeView.class, LinkOption.NOFOLLOW_LINKS).readAttributes(); Attributes attributes = new Attributes(fs, file, true, readAttributes.isDirectory(), fs.supportsExecute() ? file.canExecute() : false, readAttributes.isSymbolicLink(), readAttributes.isRegularFile(), // readAttributes.creationTime().toMillis(), // readAttributes.lastModifiedTime().toMillis(), readAttributes.isSymbolicLink() ? Constants .encode(readSymLink(file)).length : readAttributes.size()); return attributes; } catch (IOException e) { return new Attributes(file, fs); } }