/**
*
*/
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");
}
}