Java Text File Read by Encode getFileContent(FileInputStream fis, String encoding)

Here you can find the source of getFileContent(FileInputStream fis, String encoding)

Description

get File Content

License

Open Source License

Declaration

public static String getFileContent(FileInputStream fis, String encoding) throws IOException 

Method Source Code


//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();
    }
}

Related

  1. getFileContent(File file, String charset)
  2. getFileContent(File file, String charsetName)
  3. getFileContent(InputStream is, String encoding)
  4. getFileContentAsString(File file, String encoding)
  5. getFileContentAsString(File file, String encoding)
  6. getFileContentAsString(File file, String encoding)