package chenlei.test;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import Java.io.input streamreader;
//*
公共类io demo 02 {
publicstaticvoidmain (stringzqdshargs ) throws Exception { )。
}
//读取文件
publicstaticstringreadtxt (字符串路径) throws Exception { )
空!=(str=br.readline () () () ) ) ) 0
STRB.append(str;
STRB.append('rn ' );
}
br.close (;
return strb.toString (;
}
//获得编码格式gb2312、UTF-16、UTF-8、Unicode和UTF-8
publicstaticstringgetcode (string path ) throws Exception {
bytezqdsh head=new byte[3];
Inputstream.read(head;
(if(head[0]==-1head[1]==-2 ) ) ) ) ) ) ) )。
(elseif(head[0]==-2head[1]==-1 ) ) ) ) ) ) 652
(else if (head [0]==-17he ad [1]==-69 head [2]=-65 ) ) ) ) ) ) ) )。
inputStream.close (;
返回代码;
}
}