public static List<String> bytesToStringList(byte[] bytes){
  List<String> lines=new ArrayList<String>();
  if (bytes == null) {
    return lines;
  }
  BufferedReader r=null;
  try {
    r=new BufferedReader(new InputStreamReader(new ByteArrayInputStream(bytes),"UTF-8"));
  }
 catch (  UnsupportedEncodingException e) {
    throw new RuntimeException(e);
  }
  try {
    try {
      for (String line=r.readLine(); line != null; line=r.readLine()) {
        lines.add(line);
      }
    }
  finally {
      r.close();
    }
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
  return lines;
}

public static List < String > bytesToStringList ( byte [ ] bytes ) { List < String > lines = new ArrayList < String > ( ) ; if ( bytes == null ) { return lines ; } BufferedReader r = null ; try { r = new BufferedReader ( new InputStreamReader ( new ByteArrayInputStream ( bytes ) , "UTF-8" ) ) ; } catch ( UnsupportedEncodingException e ) { throw new RuntimeException ( e ) ; } try { try { for ( String line = r . readLine ( ) ; line != null ; line = r . readLine ( ) ) { lines . add ( line ) ; } } finally { r . close ( ) ; } } catch ( IOException e ) { throw new RuntimeException ( e ) ; } return lines ; }
convert an array of bytes into a list of strings using utf - 8 . a line is considered to be terminated by any one of a line feed ( ' \ n ' ) , a carriage return ( ' \ r ' ) , or a carriage return followed immediately by a linefeed . < p / > can be used to parse the output of
