blob: ec3ac2a85290d3515fd7e469a16940a53104cda5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
package com.jantuomi.tunkki.utils;
import jline.console.ConsoleReader;
import java.io.IOException;
/**
* Created by jan on 4.8.2016.
*/
public class IO {
private static IO instance = new IO();
private ConsoleReader reader;
public static IO getInstance() {
return instance;
}
private IO() {
try {
reader = new ConsoleReader();
} catch (IOException e) {
e.printStackTrace();
}
reader.setBellEnabled(false);
reader.setExpandEvents(false);
}
public String readLine(String promptMessage)
throws IOException {
System.out.print(promptMessage);
String line = reader.readLine();
return line.trim();
}
}
|