有,用字符流InputStreamReader,下边是例子
public static void readFile() throws IOException{
File f = new File("c:\\video.sql");
FileInputStream in = new FileInputStream(f);
BufferedReader reader = new BufferedReader(new InputStreamReader(in,"gbk"));
char[] c = new char[(int)f.length()];
reader.read(c);
System.out.println(new String(c));
System.out.println(c.length);
in.close();
reader.close();
}
public void myRead()throws Exception{
File file = new File("这里写你的文件路径");
BufferedInputStream bis = new BufferedInputStream (new InputStream(file));
int byte = -1;
while((byte = bis.read())!=-1){
//填写你对数据操作的代码
}
bis.close();
}
可能有错误,自己看着办就好了
双字节读取?
FileReader() ---------是按unicode编码的方式读取,这样汉字就可以一下读一个了,不过数字字母也是一下读一个
或者装饰一下啊,装饰者模式...