tanzadeh7
شنبه 02 خرداد 1394, 22:39 عصر
سلام من یه مشکلی در خواندن فایل در جاوا دارم و اونم اینه که فایل کامل خونده نمیشه.
try {
BufferedReader br = new BufferedReader(new FileReader(new File("/home/tanzadehtest.txt")));
String s;
while ((s = br.readLine()) != null) {
jTextArea1.append(br.readLine() + "\n");
}
} catch (Exception ex) {
Logger.getLogger(NewJFrame.class.getName()).log(Le vel.SEVERE, null, ex);
}
متنی که توی textarea نشون داده میشه
<body>
Hello world
</body>
محتوای داخل فایل
<html>
<body>
Hello world
</body>
</html>
try {
BufferedReader br = new BufferedReader(new FileReader(new File("/home/tanzadehtest.txt")));
String s;
while ((s = br.readLine()) != null) {
jTextArea1.append(br.readLine() + "\n");
}
} catch (Exception ex) {
Logger.getLogger(NewJFrame.class.getName()).log(Le vel.SEVERE, null, ex);
}
متنی که توی textarea نشون داده میشه
<body>
Hello world
</body>
محتوای داخل فایل
<html>
<body>
Hello world
</body>
</html>