Here you can find the source of readLines(String text)
public static String[] readLines(String text)
//package com.java2s; //License from project: LGPL import java.io.BufferedReader; import java.io.IOException; import java.io.StringReader; import java.util.Collection; import java.util.LinkedList; public class Main { public static String[] readLines(String text) { StringReader reader = new StringReader(text); BufferedReader bufReader = new BufferedReader(reader); Collection<String> tmpOut = new LinkedList<String>(); String line;/*from w w w. java2 s. com*/ try { line = bufReader.readLine(); while (line != null) { tmpOut.add(line); line = bufReader.readLine(); } } catch (IOException e) { e.printStackTrace(); } String[] out = new String[tmpOut.size()]; tmpOut.toArray(out); return out; } }