
com.panayotis.jerminal.TermUnix Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jerminal Show documentation
Show all versions of jerminal Show documentation
Terminal helper functions for Java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.panayotis.jerminal;
/**
*
* @author teras
*/
class TermUnix {
private static int width = -1;
@SuppressWarnings("UseSpecificCatch")
public synchronized static int width() {
if (width < 0)
try {
String out = SimpleLaunch.run(null, ProcessBuilder.Redirect.INHERIT, "tput", "cols");
if (out != null)
width = Integer.parseInt(out.trim());
} catch (Throwable ex) {
} finally {
if (width < 5)
width = 80;
}
return width;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy