当前位置: 首页>>代码示例>>Java>>正文


Java StringScanner.hasMoreData方法代码示例

本文整理汇总了Java中git4idea.util.StringScanner.hasMoreData方法的典型用法代码示例。如果您正苦于以下问题:Java StringScanner.hasMoreData方法的具体用法?Java StringScanner.hasMoreData怎么用?Java StringScanner.hasMoreData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在git4idea.util.StringScanner的用法示例。


在下文中一共展示了StringScanner.hasMoreData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: scanFiles

import git4idea.util.StringScanner; //导入方法依赖的package包/类
/**
 * Scan working tree and detect locally modified files
 *
 * @param project the project to scan
 * @param root    the root to scan
 * @param files   the collection with files
 * @throws VcsException if there problem with running git or working tree is dirty in unsupported way
 */
private static void scanFiles(Project project, VirtualFile root, List<String> files) throws VcsException {
  String rootPath = root.getPath();
  GitSimpleHandler h = new GitSimpleHandler(project, root, GitCommand.DIFF);
  h.addParameters("--name-status");
  h.setSilent(true);
  h.setStdoutSuppressed(true);
  StringScanner s = new StringScanner(h.run());
  while (s.hasMoreData()) {
    if (s.isEol()) {
      s.line();
      continue;
    }
    if (s.tryConsume("M\t")) {
      String path = rootPath + "/" + GitUtil.unescapePath(s.line());
      files.add(path);
    }
    else {
      throw new VcsException("Working tree is dirty in unsupported way: " + s.line());
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:30,代码来源:GitUpdateLocallyModifiedDialog.java

示例2: parseChanges

import git4idea.util.StringScanner; //导入方法依赖的package包/类
/**
 * Parse changes from lines
 *
 * @param project        the context project
 * @param vcsRoot        the git root
 * @param thisRevision   the current revision
 * @param parentRevision the parent revision for this change list
 * @param s              the lines to parse
 * @param changes        a list of changes to update
 * @param ignoreNames    a set of names ignored during collection of the changes
 * @throws VcsException if the input format does not matches expected format
 */
public static void parseChanges(Project project,
                                VirtualFile vcsRoot,
                                @Nullable GitRevisionNumber thisRevision,
                                GitRevisionNumber parentRevision,
                                String s,
                                Collection<Change> changes,
                                final Set<String> ignoreNames) throws VcsException {
  StringScanner sc = new StringScanner(s);
  parseChanges(project, vcsRoot, thisRevision, parentRevision, sc, changes, ignoreNames);
  if (sc.hasMoreData()) {
    throw new IllegalStateException("Unknown file status: " + sc.line());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:GitChangeUtils.java

示例3: load

import git4idea.util.StringScanner; //导入方法依赖的package包/类
@NotNull
public List<GitRebaseEntry> load() throws IOException, NoopException {
  String encoding = GitConfigUtil.getLogEncoding(myProject, myRoot);
  List<GitRebaseEntry> entries = ContainerUtil.newArrayList();
  final StringScanner s = new StringScanner(FileUtil.loadFile(new File(myFile), encoding));
  boolean noop = false;
  while (s.hasMoreData()) {
    if (s.isEol() || s.startsWith('#')) {
      s.nextLine();
      continue;
    }
    if (s.startsWith("noop")) {
      noop = true;
      s.nextLine();
      continue;
    }
    String action = s.spaceToken();
    String hash = s.spaceToken();
    String comment = s.line();

    entries.add(new GitRebaseEntry(action, hash, comment));
  }
  if (noop && entries.isEmpty()) {
    throw new NoopException();
  }
  return entries;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:GitInteractiveRebaseFile.java

示例4: parseRemoteListInternal

import git4idea.util.StringScanner; //导入方法依赖的package包/类
/**
 * Parse list of remotes (internal method)
 *
 * @param output the output to parse
 * @return list of remotes
 */
public static List<GitDeprecatedRemote> parseRemoteListInternal(String output) {
  ArrayList<GitDeprecatedRemote> remotes = new ArrayList<GitDeprecatedRemote>();
  StringScanner s = new StringScanner(output);
  String name = null;
  String fetch = null;
  String push = null;
  while (s.hasMoreData()) {
    String n = s.tabToken();
    if (name != null && !n.equals(name) && fetch != null) {
      if (push == null) {
        push = fetch;
      }
      remotes.add(new GitDeprecatedRemote(name, fetch, push));
      fetch = null;
      push = null;
    }
    name = n;
    String url = s.line();
    if (url.endsWith(" (push)")) {
      push = url.substring(0, url.length() - " (push)".length());
    }
    else if (url.endsWith(" (fetch)")) {
      fetch = url.substring(0, url.length() - " (fetch)".length());
    }
    else {
      fetch = url;
      push = url;
    }
  }
  if (name != null && fetch != null) {
    if (push == null) {
      push = fetch;
    }
    remotes.add(new GitDeprecatedRemote(name, fetch, push));
  }
  return remotes;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:44,代码来源:GitDeprecatedRemote.java


注:本文中的git4idea.util.StringScanner.hasMoreData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。