Here you can find the source of getFileContent(FileInputStream fis, String encoding)
public static String getFileContent(FileInputStream fis, String encoding) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static String getFileContent(FileInputStream fis, String encoding) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(fis, encoding)); StringBuilder sb = new StringBuilder(); String line;/* w w w . jav a 2s. co m*/ while ((line = br.readLine()) != null) { sb.append(line); sb.append('\n'); } return sb.toString(); } }