move clearScreen method to Shell

This commit is contained in:
Doug MacEachern 2006-06-22 02:57:23 +00:00
parent 774f110915
commit 9eeb4d8ada
2 changed files with 6 additions and 3 deletions

View File

@ -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;
}

View File

@ -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));