Here you can find the source of fileToStringOneLine(String path)
public static String fileToStringOneLine(String path)
//package com.java2s; // {LICENSE}/*from w w w .jav a2 s . co m*/ import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static String fileToStringOneLine(String path) { String string = new String(); try { BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(path))); String line; while ((line = reader.readLine()) != null) { string += line; } reader.close(); } catch (IOException e) { e.printStackTrace(); } return string; } }