Here you can find the source of readLines(InputStream inputStream)
public static String[] readLines(InputStream inputStream) throws IOException
//package com.java2s; // Licensed under the Academic Free License version 3.0 import java.io.*; import java.util.*; public class Main { /**/* www . ja v a 2 s . com*/ * Read a UTF-8 file into an array of lines. */ public static String[] readLines(File f) throws IOException { return readLines(new FileInputStream(f)); } /** * Read a UTF-8 file into an array of lines and close the stream. */ public static String[] readLines(InputStream inputStream) throws IOException { BufferedReader in = null; try { ArrayList lines = new ArrayList(); in = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); String line; while ((line = in.readLine()) != null) lines.add(line); return (String[]) lines.toArray(new String[lines.size()]); } finally { try { if (in != null) in.close(); } catch (Exception e) { } } } }