oracle存储过程接口自动生成器(二)

来源:互联网 发布:nginx 文件上传下载 编辑:程序博客网 时间:2024/05/01 00:42

 /**
 *
 */
package mytest.jdbc;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author john
 *
 */
public class FileHelper {

 public static void genFile(String pkg, String fileName, String content)
   throws IOException {


  File file = new File(fileName + ".java");

  FileWriter fo = new FileWriter(file);
  System.out.println("Ganerating the file:" + file);
  PrintWriter pw = new PrintWriter(new BufferedWriter(fo));
  pw.print(("package " + pkg + " ;/n"));
  pw.print("public interface " + fileName + "{/n");
  pw.print(content);
  pw.print("}/n");
  pw.close();
 }

 public static void main(String[] args) throws IOException, Exception {
  String pkg = FileHelper.class.getPackage().getName().replaceAll(
    "pakcage ", "");
  System.out.println(pkg);
  genFile(pkg, "123", "/t1111111111111/n");
 }
}

原创粉丝点击