Well, to the point, as title said, this method is to read text file from specifically location inside your hard-disk, it much more alike with Java Read and Write File, but this time  we using StringBuilder to append the lines of texts into one for any usage.

Here we go :

public String getProp(String fileLocation) throws FileNotFoundException, IOException
{
    StringBuilder sbProp = new StringBuilder();

    //fileLocation is string location where your text file stored
    DataInputStream dis = new DataInputStream(new FileInputStream(fileLocation));

    BufferedReader br = new BufferedReader(new InputStreamReader(dis));

    String temp;

    while ((temp = br.readLine())!=null)
    {
        sbProp.append(temp);
    }

    dis.close();
    br.close();

    return sbProp.toString();
 }

Hope this post help you.😉

For info about my newest post :