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

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

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

FS.detect介绍

[英]Auto-detect the appropriate file system abstraction.
[中]自动检测适当的文件系统抽象。

代码示例

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

/**
 * Auto-detect the appropriate file system abstraction.
 *
 * @return detected file system abstraction
 */
public static FS detect() {
  return detect(null);
}

代码示例来源: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

/**
 * Get the default SSH session
 *
 * @return a remote session
 * @throws org.eclipse.jgit.errors.TransportException
 *             in case of error with opening SSH session
 */
protected RemoteSession getSession() throws TransportException {
  if (sock != null)
    return sock;
  final int tms = getTimeout() > 0 ? getTimeout() * 1000 : 0;
  final FS fs = local == null ? FS.detect() : local.getFS();
  sock = sch
      .getSession(uri, getCredentialsProvider(), fs, tms);
  return sock;
}

代码示例来源: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: diffplug/spotless

FS fs = FS.detect();
if (globalAttributesPath.startsWith("~/")) { //$NON-NLS-1$
  globalAttributesFile = fs.resolve(fs.userHome(), globalAttributesPath.substring(2));

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

/**
 * Auto-detect the appropriate file system abstraction.
 *
 * @return detected file system abstraction
 */
public static FS detect() {
  return detect(null);
}

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

/**
 * Auto-detect the appropriate file system abstraction.
 *
 * @return detected file system abstraction
 */
public static FS detect() {
  return detect(null);
}

代码示例来源:origin: matburt/mobileorg-android

public void connect() {
    try {
      SshSessionFactory sshSessionFactory = new SshSessionFactory(context);
      JSch jSch = sshSessionFactory.createDefaultJSch(FS.detect());

      session = jSch.getSession(
          authData.getUser(),
          authData.getHost(),
          authData.getPort());

      session.setPassword(AuthData.getInstance(context).getPassword());

      // TODO: find a way to check for host key
//            jSch.setKnownHosts("/storage/sdcard0/Download/known_hosts");
      session.setConfig("StrictHostKeyChecking", "no");

      session.connect();
      session.disconnect();
    } catch (JSchException e) {
      e.printStackTrace();
    }

  }

代码示例来源: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: sonia.jgit/org.eclipse.jgit

/**
 * Get the default SSH session
 * 
 * @return a remote session
 * @throws TransportException
 *             in case of error with opening SSH session
 */
protected RemoteSession getSession() throws TransportException {
  if (sock != null)
    return sock;
  final int tms = getTimeout() > 0 ? getTimeout() * 1000 : 0;
  final FS fs = local == null ? FS.detect() : local.getFS();
  sock = sch
      .getSession(uri, getCredentialsProvider(), fs, tms);
  return sock;
}

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

/**
 * Get the default SSH session
 *
 * @return a remote session
 * @throws org.eclipse.jgit.errors.TransportException
 *             in case of error with opening SSH session
 */
protected RemoteSession getSession() throws TransportException {
  if (sock != null)
    return sock;
  final int tms = getTimeout() > 0 ? getTimeout() * 1000 : 0;
  final FS fs = local == null ? FS.detect() : local.getFS();
  sock = sch
      .getSession(uri, getCredentialsProvider(), fs, tms);
  return sock;
}

代码示例来源:origin: com.diffplug.spotless/spotless-lib-extra

FS fs = FS.detect();
if (globalAttributesPath.startsWith("~/")) { //$NON-NLS-1$
  globalAttributesFile = fs.resolve(fs.userHome(), globalAttributesPath.substring(2));

代码示例来源: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));
  }
}

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

node.flush();
File gitPrefix = FS.detect().gitPrefix();

相关文章