protected Iterable < String > readtext ( String name , boolean unescapeNewlines ) throws IOException { ArrayList < String > res = new ArrayList <> ( 50 ) ; BufferedReader br = _reader . getTextFile ( name ) ; try { String line ; while ( true ) { line = br . readLine ( ) ; if ( line == null ) break ; if ( unescapeNewlines ) line = StringEscapeUtils . unescapeNewlines ( line ) ; res . add ( line . trim ( ) ) ; } br . close ( ) ; } finally { try { br . close ( ) ; } catch ( IOException e ) { /* ignored */ } } return res ; }
Retrieve text previously saved using startWritingTextFile + writeln as an array of lines . Each line is trimmed to remove the leading and trailing whitespace . Removes escaping of the new line characters in enabled .