日期:2014-05-20 浏览次数:20976 次
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package mybean;
/**
*
* @author YAYA
*/
import java.io.*;
import java.util.logging.Level;
import java.util.logging.Logger;
public class NewClass {
public static String file2string(String filename) throws IOException{
StringBuilder sb=new StringBuilder();
String s;
BufferedReader in = new BufferedReader(new FileReader(filename));
while((s=in.readLine())!=null){
sb.append(s+"\n");
}
return sb.toString();
}
public static void main(String args[]){
try {
DataInputStream in = new DataInputStream(new ByteArrayInputStream((file2string("E:\\a.info")).getBytes()));
Byte d;
while(true){
System.out.print((char)in.readByte());}
} catch (IOException ex) {
Logger.getLogger(NewClass.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
------解决方案--------------------
文本编译器都读取不了,你这个代码注定是悲剧