• R/O
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythongamewindowsbathyscaphephpguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

OmegaT の背景に画像を表示します。


Commit MetaInfo

Revisão81 (tree)
Hora2017-05-31 17:38:22
Autoryu-tang

Mensagem de Log

support OmegaT 4.1.1b

Mudança Sumário

Diff

--- trunk/src/jp/osdn/users/yutang/omegat/plugin/moenizer/MoeConfig.java (revision 80)
+++ trunk/src/jp/osdn/users/yutang/omegat/plugin/moenizer/MoeConfig.java (revision 81)
@@ -24,6 +24,7 @@
2424 import java.io.IOException;
2525 import java.io.Writer;
2626 import java.net.URISyntaxException;
27+import java.nio.charset.StandardCharsets;
2728 import java.util.ArrayList;
2829 import java.util.Comparator;
2930 import java.util.HashMap;
@@ -66,7 +67,7 @@
6667 public MoeConfig(File file) throws IOException {
6768 this.file = file;
6869 if (file.isFile()) {
69- String script = FileUtil.readTextFile(file); // as UTF-8
70+ String script = MoeUtil.readTextFile(file, StandardCharsets.UTF_8);
7071 config = createBindedConfigSlurper().parse(script);
7172 addAll(sortedConfigs, config);
7273 }
--- trunk/src/jp/osdn/users/yutang/omegat/plugin/moenizer/MoeConfigEditDialog.java (revision 80)
+++ trunk/src/jp/osdn/users/yutang/omegat/plugin/moenizer/MoeConfigEditDialog.java (revision 81)
@@ -9,7 +9,7 @@
99 import groovy.util.ConfigObject;
1010 import java.util.Set;
1111 import org.omegat.core.Core;
12-import org.omegat.util.StaticUtils;
12+import org.omegat.util.StringUtil;
1313
1414 /**
1515 *
@@ -34,8 +34,8 @@
3434 }
3535
3636 private void initUI() {
37- this.setTitle(StaticUtils.format(L10n.get(L10n.Key.DIALOG_TITLE),
38- L10n.get(L10n.Key.CURRENT_VERSION)));
37+ this.setTitle(StringUtil.format(L10n.get(L10n.Key.DIALOG_TITLE),
38+ L10n.get(L10n.Key.CURRENT_VERSION)));
3939 }
4040
4141 /**
--- trunk/src/jp/osdn/users/yutang/omegat/plugin/moenizer/MoeUtil.java (revision 80)
+++ trunk/src/jp/osdn/users/yutang/omegat/plugin/moenizer/MoeUtil.java (revision 81)
@@ -21,9 +21,10 @@
2121 import java.io.FileInputStream;
2222 import java.io.IOException;
2323 import java.io.InputStreamReader;
24-import java.io.StringWriter;
2524 import java.net.URISyntaxException;
2625 import java.net.URL;
26+import java.nio.charset.Charset;
27+import java.nio.charset.StandardCharsets;
2728 import java.security.CodeSource;
2829 import java.util.ArrayList;
2930 import java.util.Collections;
@@ -30,9 +31,7 @@
3031 import java.util.List;
3132 import java.util.regex.Matcher;
3233 import java.util.regex.Pattern;
33-import org.omegat.util.LFileCopy;
3434 import org.omegat.util.Log;
35-import org.omegat.util.OConsts;
3635 import org.omegat.util.StaticUtils;
3736
3837 /**
@@ -85,7 +84,7 @@
8584
8685 } else if (fileName.endsWith(".webloc")) {
8786 // .webloc is Mac OS X Website Location file for safari
88- String text = readTextFile(file, OConsts.UTF8);
87+ String text = readTextFile(file, StandardCharsets.UTF_8);
8988 Matcher matcher = RE_URL_IN_WEBLOC.matcher(text);
9089 if (matcher.find()) {
9190 return new URL(matcher.group(1));
@@ -103,14 +102,22 @@
103102 }
104103
105104 /**
106- * Read file as platform dependent encoding text.
105+ * Read file as specified encoding text.
107106 */
108107 public static String readTextFile(File file, String encoding) throws IOException {
108+ Charset charset = Charset.forName(encoding);
109+ return readTextFile(file, charset);
110+ }
111+
112+ /**
113+ * Read file as specified encoding text.
114+ */
115+ public static String readTextFile(File file, Charset encoding) throws IOException {
109116 BufferedReader rd = new BufferedReader(new InputStreamReader(new FileInputStream(file), encoding));
110117 try {
111- StringWriter out = new StringWriter();
112- LFileCopy.copy(rd, out);
113- return out.toString();
118+ char[] cbuf = new char[(int) file.length()];
119+ rd.read(cbuf);
120+ return String.valueOf(cbuf);
114121 } finally {
115122 rd.close();
116123 }
--- trunk/src/jp/osdn/users/yutang/omegat/plugin/moenizer/gui/ConfigEditDialog.java (revision 80)
+++ trunk/src/jp/osdn/users/yutang/omegat/plugin/moenizer/gui/ConfigEditDialog.java (revision 81)
@@ -21,7 +21,7 @@
2121 import jp.osdn.users.yutang.omegat.plugin.moenizer.L10n;
2222 import jp.osdn.users.yutang.omegat.plugin.moenizer.ThemeChanger;
2323 import org.omegat.core.Core;
24-import org.omegat.util.StaticUtils;
24+import org.omegat.util.StringUtil;
2525
2626 /**
2727 *
@@ -46,8 +46,8 @@
4646 }
4747
4848 private void initUI() {
49- this.setTitle(StaticUtils.format(L10n.get(L10n.Key.DIALOG_TITLE),
50- L10n.get(L10n.Key.CURRENT_VERSION)));
49+ this.setTitle(StringUtil.format(L10n.get(L10n.Key.DIALOG_TITLE),
50+ L10n.get(L10n.Key.CURRENT_VERSION)));
5151 }
5252
5353 private void initComponents() {