Here you can find the source of readFile(InputStream location)
static String[] readFile(InputStream location)
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; public class Main { static String[] readFile(InputStream location) { ArrayList<String> readLines = new ArrayList<>(); try (BufferedReader br = new BufferedReader(new InputStreamReader(location))) { String line = br.readLine(); while (line != null) { readLines.add(line);// ww w. j a v a 2 s. com line = br.readLine(); } } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } return readLines.toArray(new String[readLines.size()]); } }