17 package com.generalrobotix.ui.util;
20 import java.nio.channels.*;
38 FileChannel srcChannel =
new FileInputStream(srcPath).getChannel();
39 FileChannel destChannel =
new FileOutputStream(destPath).getChannel();
41 srcChannel.transferTo(0, srcChannel.size(), destChannel);
56 public static void resourceToFile(Class<? extends GrxPluginManager> grxPluginManager, String srcName,
File destFile)
58 InputStream in = grxPluginManager.getResourceAsStream(srcName.toString());
59 OutputStream out =
new FileOutputStream(destFile.toString());
61 byte[]
buf =
new byte[1024];
63 while ((len = in.read(buf)) > 0) {
64 out.write(buf, 0, len);
66 }
catch (IOException e) {
81 if (System.getProperty(
"os.name").equals(
"Linux") || System.getProperty(
"os.name").equals(
"Mac OS X")) {
82 com =
new String[] {
"/bin/sh",
"-c",
"rm " + logPath +
File.separator +
"*" };
84 logPath = logPath.replaceFirst(
"^\"",
"");
85 logPath = logPath.replaceFirst(
"\"$",
"");
86 com =
new String[] {
"cmd",
"/c",
"del " +
"\"" + logPath +
File.separator +
"omninames-*.*" +
"\""};
89 Process pr = Runtime.getRuntime().exec(com);
90 InputStream is = pr.getInputStream();
91 BufferedReader br =
new BufferedReader(
new InputStreamReader(is));
94 while ((line = br.readLine()) !=
null) {
95 System.out.println(line);
97 }
catch (Exception e) {
static void resourceToFile(Class<?extends GrxPluginManager > grxPluginManager, String srcName, File destFile)
#define null
our own NULL pointer
static void deleteNameServerLog(String logPath)
omniName サーバのログファイル削除
static void copyTransfer(String srcPath, String destPath)
コピー元のパス[srcPath]から、コピー先のパス[destPath]へ ファイルのコピーを行います。 コピー処理にはFi...
プラグイン管理クラス GrxUIの核になるクラス。プラグインのロード等の、初期化を実行する。 プラグインとそ...