When wanting to get a file as a String in Java, don't read it line-wise, but do it like this, as it's more efficient. You can fiind the code HERE

import java.io.*;

public class Stringifier {
    /**
     * Description of the Method
     *
     @param file
     *          The file to be turned into a String
     * @return  The file as String encoded in the platform
     * default encoding
     */
    public static String fileToString(File file) {
        String result = null;
        DataInputStream in = null;

        try {
            byte[] buffer = new byte[(int) file.length()];
            in = new DataInputStream(new FileInputStream(file));
            in.readFully(buffer);
            result = new String(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                in.close();
            } catch (IOException e) { /* ignore it */
            }
        }

        return result;
    }
}