package outils; 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; } }