private String read(InputStreamReader console, boolean echo) {
		StringBuilder builder = new StringBuilder();
		try {
			for (char c = (char) console.read(); !(c == '\n' || c == '\r'); c = (char) console.read()) {
				if (echo) {
					System.out.print(c);
				}
				builder.append(c);
			}
			System.out.println();
		}
		catch (IOException e) {
			throw new IllegalStateException(e);
		}
		return builder.toString();
	}
Reads a single line of input from the console.

 @param console input
 @param echo    whether the input should be echoed (e.g. false for passwords, other sensitive data)
spring-xd-shell/src/main/java/org/springframework/xd/shell/command/ConsoleUserInput.java