本文整理汇总了Java中git4idea.config.GitConfigUtil.getLogEncoding方法的典型用法代码示例。如果您正苦于以下问题:Java GitConfigUtil.getLogEncoding方法的具体用法?Java GitConfigUtil.getLogEncoding怎么用?Java GitConfigUtil.getLogEncoding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类git4idea.config.GitConfigUtil
的用法示例。
在下文中一共展示了GitConfigUtil.getLogEncoding方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: load
import git4idea.config.GitConfigUtil; //导入方法依赖的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;
}
示例2: save
import git4idea.config.GitConfigUtil; //导入方法依赖的package包/类
public void save(@NotNull List<GitRebaseEntry> entries) throws IOException {
String encoding = GitConfigUtil.getLogEncoding(myProject, myRoot);
PrintWriter out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(myFile), encoding));
try {
for (GitRebaseEntry e : entries) {
if (e.getAction() != GitRebaseEntry.Action.skip) {
out.println(e.getAction().toString() + " " + e.getCommit() + " " + e.getSubject());
}
}
}
finally {
out.close();
}
}
示例3: save
import git4idea.config.GitConfigUtil; //导入方法依赖的package包/类
/**
* Save text to the file
*
* @param file the file to save to
* @throws IOException if there is IO problem
*/
public void save(final String file) throws IOException {
String encoding = GitConfigUtil.getLogEncoding(myProject, myGitRoot);
PrintWriter out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file), encoding));
try {
for (GitRebaseEntry e : myEntries) {
if (e.getAction() != GitRebaseEntry.Action.skip) {
out.println(e.getAction().toString() + " " + e.getCommit() + " " + e.getSubject());
}
}
}
finally {
out.close();
}
}