⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 function.java

📁 一个用Java成功实现的词发分析工具
💻 JAVA
字号:
package hartech.kids.fileKits;

import java.io.*;
import hartech.J;

/**
 * <p>Title: TransformFile To ClipBoard</p>
 *
 * <p>Description: </p>
 *
 * <p>Website: www.hartech.cn </p>
 * <p>Page: http://www.hartech.cn/blog/blogview.asp?logID=86 </p>
 * <p>Date: 2006-08-30 </p>
 */
public class Function {

  public static String transformFile(String src) {
    return transformFile(new File(src));
  }

  public static String transformFile(File src) {
    String lineStr, string = "";
    StringBuffer sb = new StringBuffer();
    int i = 0;
    BufferedReader in = null;
    try {
      in = new BufferedReader(new FileReader(src));
      while ( (lineStr = in.readLine()) != null) {
        // add transform codes here
        // line by line
        // eg. String lineStr=function(lineStr)
        i = 0;
        if (!lineStr.equals("")) {
          while (lineStr.charAt(i) == J.SPACEC) {
            lineStr = lineStr.replaceFirst(J.SPACES, J.TABS);
            i++;
          }
        }
        // code end
        sb.append(lineStr + "\r\n");
      }
      string = "Transform File is done: \r\n\r\nFrom:    " + src +
          "\r\nTo:         ClipBoard";
      //J.p(string);
    }
    catch (FileNotFoundException ex) {
      string = "File Not Found!";
      J.pw(string);
    }
    catch (IOException ex) {
      string = "IO exception!";
      J.pw(string);
    }
    finally {
      try {
        in.close();
      }
      catch (IOException ex) {
        string = "IOException when closing!";
        J.pw(string);
      }
      J.stringToClipBoard(sb.toString());
      return string;
    }
  }

  public static void main(String[] args) {
    transformFile("E:/JProject/scr/hartech/Ooop.java");
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -