//读取文件中的内容将其显示出来
public class ReadFile{
public static void main(String[] args) {
int b;
byte tom[] = new byte[1000];
File file = new File("c://system.xml");
try {
FileInputStream f = new FileInputStream(file);
b = f.read(tom,0,280);
while(b!=-1){
//StringBuffer str = new StringBuffer();
String str = new String(tom,0,b);
System.out.println(str);
break;
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
读取文件中的内容将其显示出来
最新推荐文章于 2021-12-14 23:03:39 发布