Code example for LineReader

0
  private static class StringLineReader { 
 
    private final LineReader lineReader;
 
    StringLineReader(String str) {
      lineReader = new LineReader(new StringReader(str));
    } 
 
    String readLine() {
      try { 
        return this.lineReader.readLine();
      } catch (IOException e) {
        throw new RuntimeException(e);
      } 
    } 
  } 
 
  @Override 
  public String toString() {
    return name;