public String readerFile(String filePath) {
StringBuffer sb = new StringBuffer();
File f = new File(filePath);
if (f.exists()) {
try {
// 下为读取文件
BufferedReader raf = new BufferedReader(
new FileReader(filePath));
String line = "";
int i=0;
while ((line = raf.readLine()) != null) {
if (line.trim().length() > 0) {
if(i<2||(i%2)!=0)
{
sb.append(line + "/r/n");
}
else
{
sb.append(line);
}
}
i++;
}
raf.close();
} catch (Exception e) {
e.printStackTrace();
}
}
String b = sb.toString();
// b = b.substring(0, b.length() - 2);
return b;
}
StringBuffer sb = new StringBuffer();
File f = new File(filePath);
if (f.exists()) {
try {
// 下为读取文件
BufferedReader raf = new BufferedReader(
new FileReader(filePath));
String line = "";
int i=0;
while ((line = raf.readLine()) != null) {
if (line.trim().length() > 0) {
if(i<2||(i%2)!=0)
{
sb.append(line + "/r/n");
}
else
{
sb.append(line);
}
}
i++;
}
raf.close();
} catch (Exception e) {
e.printStackTrace();
}
}
String b = sb.toString();
// b = b.substring(0, b.length() - 2);
return b;
}

被折叠的 条评论
为什么被折叠?



