[size=medium][color=indigo]//将指定的磁盘信息读取出来
public String read(String path) {
File file=new File(path);
String file_context= "";
byte[] bytes = null;
try {
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
int n = (int)file.length();
bytes = new byte[n];
bis.read(bytes);
file_context = new String(bytes);
}
catch (IOException ex) {
ex.printStackTrace();
}
return file_context;
}[/color][/size]
public String read(String path) {
File file=new File(path);
String file_context= "";
byte[] bytes = null;
try {
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
int n = (int)file.length();
bytes = new byte[n];
bis.read(bytes);
file_context = new String(bytes);
}
catch (IOException ex) {
ex.printStackTrace();
}
return file_context;
}[/color][/size]