move clearScreen method to Shell
This commit is contained in:
parent
774f110915
commit
9eeb4d8ada
|
@ -30,6 +30,7 @@ import net.hyperic.sigar.util.Getline;
|
|||
public class Shell extends ShellBase {
|
||||
|
||||
public static final String RCFILE_NAME = ".sigar_shellrc";
|
||||
private static final String CLEAR_SCREEN = "\033[2J";
|
||||
|
||||
private Sigar sigar = new Sigar();
|
||||
private SigarProxy proxy = SigarProxyCache.newInstance(this.sigar);
|
||||
|
@ -39,6 +40,10 @@ public class Shell extends ShellBase {
|
|||
public Shell() {
|
||||
}
|
||||
|
||||
public static void clearScreen() {
|
||||
System.out.print(CLEAR_SCREEN);
|
||||
}
|
||||
|
||||
public SigarProxy getSigarProxy() {
|
||||
return this.proxy;
|
||||
}
|
||||
|
|
|
@ -27,8 +27,6 @@ public class Top {
|
|||
private static final String HEADER =
|
||||
"PID\tUSER\tSTIME\tSIZE\tRSS\tSHARE\tSTATE\tTIME\t%CPU\tCOMMAND";
|
||||
|
||||
private static final String CLEAR_SCREEN = "\033[2J";
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
Sigar sigarImpl = new Sigar();
|
||||
|
||||
|
@ -36,7 +34,7 @@ public class Top {
|
|||
SigarProxyCache.newInstance(sigarImpl, SLEEP_TIME);
|
||||
|
||||
while (true) {
|
||||
System.out.print(CLEAR_SCREEN);
|
||||
Shell.clearScreen();
|
||||
|
||||
System.out.println(Uptime.getInfo(sigar));
|
||||
|
||||
|
|
Loading…
Reference in New Issue