2023-07-09 21:11:39 +02:00
|
|
|
package outils;
|
2023-06-22 13:27:37 +02:00
|
|
|
|
|
|
|
import java.io.BufferedReader;
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStreamReader;
|
|
|
|
|
|
|
|
public class lectureFileToString {
|
|
|
|
|
|
|
|
public static String lecture(String filePath) {
|
|
|
|
String xmlString = "";
|
|
|
|
|
|
|
|
try (BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(filePath), "UTF-8"))) {
|
|
|
|
StringBuilder content = new StringBuilder();
|
|
|
|
String line;
|
|
|
|
|
|
|
|
while ((line = br.readLine()) != null) {
|
|
|
|
content.append(line).append("\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
xmlString = content.toString();
|
|
|
|
} catch (IOException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
return xmlString;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|