2
Guys I’m reading a.txt file and would like to save all the strings as I could save it all ? Below follows my writing code I am using , in case I would like to guard the String line .
public static void main(String[] args) throws IOException {
try {
File f = new File ("c:/teste.txt");
InputStream is = new FileInputStream("c:/teste.txt");
InputStreamReader isr = new InputStreamReader(is);
BufferedReader reader = new BufferedReader(isr);
String linha = reader.readLine();
while (linha != null) {
System.out.println(linha);
linha = reader.readLine();
}
reader.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}