import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
public class Main {
public static void main(String[] args) {
String inputFilePath = "path/to/input/file.txt";
String outputFilePath = "path/to/output/file.txt";
try {
readAndWriteFile(inputFilePath, outputFilePath);
} catch (IOException e) {
e.printStackTrace();
}
}
public static void readAndWriteFile(String inputFilePath, String outputFilePath) throws IOException {
File inputFile = new File(inputFilePath);
File outputFile = new File(outputFilePath);
try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(inputFile), "UTF-8"));
BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile), "UTF-8"))) {
String line;
while ((line = bufferedReader.readLine()) != null) {
bufferedWriter.write(line);
bufferedWriter.newLine();
}
}
}
}