@Test public void testLoadFileAsString() throws Exception { System.out.println("loadFileAsString"); String subFolderAndFilename = "/src/test/testfiles/fileLoaderFileAsStringTest.txt"; String superFolder = SuperFolderFinder.getSuperFolder(); String location = superFolder + subFolderAndFilename; File file = new File(location); LinkedList<String> expResult = new LinkedList<>(); expResult.add("erste Zeile"); expResult.add("zweite Zeile"); expResult.add("ende"); LinkedList<String> result = FileLoader.loadFileAsString(file); assertEquals(expResult.size(), result.size()); for (int i = 0; i < result.size(); i++) { assertEquals(expResult.get(i), result.get(i)); } }
public static LinkedList<String> loadFileAsString(File file) throws FileNotFoundException, IOException { LinkedList<String> stringlist; InputStream inputStream = new FileInputStream(file); BufferedReader br = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); stringlist = new LinkedList<>(); String line; line = br.readLine(); while (line != null) { stringlist.add(line); line = br.readLine(); } br.close(); return stringlist; }
FileLoader { public static LinkedList<String> loadFileAsString(File file) throws FileNotFoundException, IOException { LinkedList<String> stringlist; InputStream inputStream = new FileInputStream(file); BufferedReader br = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); stringlist = new LinkedList<>(); String line; line = br.readLine(); while (line != null) { stringlist.add(line); line = br.readLine(); } br.close(); return stringlist; } }
FileLoader { public static LinkedList<String> loadFileAsString(File file) throws FileNotFoundException, IOException { LinkedList<String> stringlist; InputStream inputStream = new FileInputStream(file); BufferedReader br = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); stringlist = new LinkedList<>(); String line; line = br.readLine(); while (line != null) { stringlist.add(line); line = br.readLine(); } br.close(); return stringlist; } private  FileLoader(); }
FileLoader { public static LinkedList<String> loadFileAsString(File file) throws FileNotFoundException, IOException { LinkedList<String> stringlist; InputStream inputStream = new FileInputStream(file); BufferedReader br = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); stringlist = new LinkedList<>(); String line; line = br.readLine(); while (line != null) { stringlist.add(line); line = br.readLine(); } br.close(); return stringlist; } private  FileLoader(); static LinkedList<String> loadFileAsString(File file); static BufferedImage loadFileAsImage(File toRead); static synchronized String getNewUniqueName(String pathToDir); static List<String> listAllFilesFromFolder(String pathToDir, String endsWith); }
FileLoader { public static LinkedList<String> loadFileAsString(File file) throws FileNotFoundException, IOException { LinkedList<String> stringlist; InputStream inputStream = new FileInputStream(file); BufferedReader br = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); stringlist = new LinkedList<>(); String line; line = br.readLine(); while (line != null) { stringlist.add(line); line = br.readLine(); } br.close(); return stringlist; } private  FileLoader(); static LinkedList<String> loadFileAsString(File file); static BufferedImage loadFileAsImage(File toRead); static synchronized String getNewUniqueName(String pathToDir); static List<String> listAllFilesFromFolder(String pathToDir, String endsWith);  }