org.eclipse.jgit.util.FileUtils.readSymLink()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中org.eclipse.jgit.util.FileUtils.readSymLink()方法的一些代码示例,展示了FileUtils.readSymLink()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.readSymLink()方法的具体详情如下:
包路径:org.eclipse.jgit.util.FileUtils
类名称:FileUtils
方法名:readSymLink

FileUtils.readSymLink介绍

[英]Read target path of the symlink.
[中]读取符号链接的目标路径。

代码示例

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

/**
 * 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);
}

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

/**
 * @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);
  }
}

代码示例来源:origin: sonia.jgit/org.eclipse.jgit

/**
 * 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);
}

代码示例来源:origin: berlam/github-bucket

/**
 * 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);
}

代码示例来源:origin: sonia.jgit/org.eclipse.jgit

/**
 * @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);
}

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit.java7

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);
  }
}

代码示例来源:origin: sonia.jgit/org.eclipse.jgit

/**
 * @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);
  }
}

代码示例来源:origin: com.madgag/org.eclipse.jgit.java7

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);
  }
}

代码示例来源:origin: berlam/github-bucket

/**
 * @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);
  }
}

相关文章