Here you can find the source of InputStreamToStringArray(InputStream input_stream)
public static String[] InputStreamToStringArray(InputStream input_stream) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.LinkedList; import java.util.List; public class Main { public static String[] InputStreamToStringArray(InputStream input_stream) throws Exception { return InputStreamToStringList(input_stream).toArray(new String[0]); }// w w w. j a v a2 s . c o m public static List<String> InputStreamToStringList(InputStream input_stream) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(input_stream, "UTF-8")); List<String> lstRet = new LinkedList<>(); String sBuffer = br.readLine(); while (sBuffer != null) { lstRet.add(sBuffer); sBuffer = br.readLine(); } return lstRet; } }