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

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

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

FS.normalize介绍

[英]Normalize the unicode path to composed form.
[中]将unicode路径规范化为组合形式。

代码示例

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

/**
 * Create a new file entry given the specified FileModeStrategy
 *
 * @param f
 *            file
 * @param fs
 *            file system
 * @param attributes
 *            of the file
 * @param fileModeStrategy
 *            the strategy to use when determining the FileMode of a
 *            file; controls gitlinks etc.
 *
 * @since 5.0
 */
public FileEntry(File f, FS fs, FS.Attributes attributes,
    FileModeStrategy fileModeStrategy) {
  this.fs = fs;
  this.attributes = attributes;
  f = fs.normalize(f);
  mode = fileModeStrategy.getMode(f, attributes);
}

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

/**
 * Create a new file entry given the specified FileModeStrategy
 *
 * @param f
 *            file
 * @param fs
 *            file system
 * @param fileModeStrategy
 *            the strategy to use when determining the FileMode of a
 *            file; controls gitlinks etc.
 *
 * @since 4.3
 */
public FileEntry(File f, FS fs, FileModeStrategy fileModeStrategy) {
  this.fs = fs;
  f = fs.normalize(f);
  attributes = fs.getAttributes(f);
  mode = fileModeStrategy.getMode(f, attributes);
}

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

private static String readContentAsNormalizedString(DirCacheEntry entry,
    ObjectReader reader) throws MissingObjectException, IOException {
  ObjectLoader open = reader.open(entry.getObjectId());
  byte[] cachedBytes = open.getCachedBytes();
  return FS.detect().normalize(RawParseUtils.decode(cachedBytes));
}

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

/**
 * Reads the target of a symlink as a string. This default implementation
 * fully reads the entry's input stream and converts it to a normalized
 * string. Subclasses may override to provide more specialized
 * implementations.
 *
 * @param entry
 *            to read
 * @return the entry's content as a normalized string
 * @throws java.io.IOException
 *             if the entry cannot be read or does not denote a symlink
 * @since 4.6
 */
protected String readSymlinkTarget(Entry entry) throws IOException {
  if (!entry.getMode().equals(FileMode.SYMLINK)) {
    throw new java.nio.file.NotLinkException(entry.getName());
  }
  long length = entry.getLength();
  byte[] content = new byte[(int) length];
  try (InputStream is = entry.openInputStream()) {
    int bytesRead = IO.readFully(is, content, 0);
    return FS.detect()
        .normalize(RawParseUtils.decode(content, 0, bytesRead));
  }
}

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

/**
 * Create a new file entry given the specified FileModeStrategy
 *
 * @param f
 *            file
 * @param fs
 *            file system
 * @param attributes
 *            of the file
 * @param fileModeStrategy
 *            the strategy to use when determining the FileMode of a
 *            file; controls gitlinks etc.
 *
 * @since 5.0
 */
public FileEntry(File f, FS fs, FS.Attributes attributes,
    FileModeStrategy fileModeStrategy) {
  this.fs = fs;
  this.attributes = attributes;
  f = fs.normalize(f);
  mode = fileModeStrategy.getMode(f, attributes);
}

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

/**
 * Create a new file entry given the specified FileModeStrategy
 *
 * @param f
 *            file
 * @param fs
 *            file system
 * @param fileModeStrategy
 *            the strategy to use when determining the FileMode of a
 *            file; controls gitlinks etc.
 *
 * @since 4.3
 */
public FileEntry(File f, FS fs, FileModeStrategy fileModeStrategy) {
  this.fs = fs;
  f = fs.normalize(f);
  attributes = fs.getAttributes(f);
  mode = fileModeStrategy.getMode(f, attributes);
}

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

/**
 * Create a new file entry given the specified FileModeStrategy
 *
 * @param f
 *            file
 * @param fs
 *            file system
 * @param fileModeStrategy
 *            the strategy to use when determining the FileMode of a
 *            file; controls gitlinks etc.
 *
 * @since 4.3
 */
public FileEntry(File f, FS fs, FileModeStrategy fileModeStrategy) {
  this.fs = fs;
  f = fs.normalize(f);
  attributes = fs.getAttributes(f);
  mode = fileModeStrategy.getMode(f, attributes);
}

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

private static String readContentAsNormalizedString(DirCacheEntry entry,
    ObjectReader reader) throws MissingObjectException, IOException {
  ObjectLoader open = reader.open(entry.getObjectId());
  byte[] cachedBytes = open.getCachedBytes();
  return FS.detect().normalize(RawParseUtils.decode(cachedBytes));
}

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

private static String readContentAsNormalizedString(Entry entry) throws IOException {
  long length = entry.getLength();
  byte[] content = new byte[(int) length];
  InputStream is = entry.openInputStream();
  IO.readFully(is, content, 0, (int) length);
  return FS.detect().normalize(RawParseUtils.decode(content));
}

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

private static String readContentAsNormalizedString(DirCacheEntry entry,
    ObjectReader reader) throws MissingObjectException, IOException {
  ObjectLoader open = reader.open(entry.getObjectId());
  byte[] cachedBytes = open.getCachedBytes();
  return FS.detect().normalize(RawParseUtils.decode(cachedBytes));
}

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

/**
 * Reads the target of a symlink as a string. This default implementation
 * fully reads the entry's input stream and converts it to a normalized
 * string. Subclasses may override to provide more specialized
 * implementations.
 *
 * @param entry
 *            to read
 * @return the entry's content as a normalized string
 * @throws java.io.IOException
 *             if the entry cannot be read or does not denote a symlink
 * @since 4.6
 */
protected String readSymlinkTarget(Entry entry) throws IOException {
  if (!entry.getMode().equals(FileMode.SYMLINK)) {
    throw new java.nio.file.NotLinkException(entry.getName());
  }
  long length = entry.getLength();
  byte[] content = new byte[(int) length];
  try (InputStream is = entry.openInputStream()) {
    int bytesRead = IO.readFully(is, content, 0);
    return FS.detect()
        .normalize(RawParseUtils.decode(content, 0, bytesRead));
  }
}

相关文章