FileInputStream fr = null;//必需使用FileInputStream, 才能透過InputStreamReader指定編碼方式
fr = new FileInputStream("C:\\Tomcat\\webapps\\ROOT\\spadmin\\include\\spadmin.sql" );
BufferedReader bufReader = new BufferedReader( new InputStreamReader( fr,"UTF-8" ) );
String post ="";
StringBuffer defer = new StringBuffer();
while(true)
{
post = bufReader.readLine();
if (post==null) break;
if (post.length()>2){
if(post.substring(0,2).equals("--")){
post="";
}
}
defer.append(post);
}
沒有留言:
張貼留言