package alura.com.br.Io.teste;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
public class RecebendoEJuntando {
public static void main(String[] args) throws IOException {
// leitura
FileInputStream fis = new FileInputStream("lorem.txt");
InputStreamReader isr = new InputStreamReader(fis);
BufferedReader br = new BufferedReader(isr);
// escrita
OutputStream os = new FileOutputStream("teste.txt");
Writer wr = new OutputStreamWriter(os);
BufferedWriter bw = new BufferedWriter(wr);
String lendo = br.readLine();
while(lendo != null) {
bw.append(lendo);
lendo = br.readLine();
bw.newLine();
}
bw.close();
}
}
Deu tudo certo!