test.java

来自「chatper4JdonCMS.rar」· Java 代码 · 共 60 行

JAVA
60
字号
package com.jdon.cms;

import java.io.*;
import com.jdon.util.*;
import com.jdon.cms.template.JspMaker;


public class Test {
  public static String readFile(String input) throws Exception {
     char[] buffer = new char[1];
     int len = 0;
     StringBuffer content = null;


     String ENCODING = "UTF-8";

     try {
       InputStreamReader fr = new InputStreamReader(new FileInputStream(input),
           ENCODING);


       BufferedReader br = new BufferedReader(fr);

       content = new StringBuffer();
       while ( (len = br.read(buffer)) > -1) {
             System.out.println(buffer);
         content.append(buffer, 0, len);
       }

       br.close();
       fr.close();
     } catch (Exception e) {
       throw new Exception(e);
     }
     return content.toString();
   }



  public static void main(String[] args) {


    try {


    String  jspTemplateFile = "D:\\javasource\\CMS\\web\\1.jsp";

    String text = readFile(jspTemplateFile);
    System.out.println("" + text);



    } catch (Exception e) {
      System.out.println("Uh oh, got an IOException error!");
      e.printStackTrace();
    }
  }


}

⌨️ 快捷键说明

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