Class TerminalUtils


  • public class TerminalUtils
    extends java.lang.Object
    Since:
    0.9.0
    • Field Detail

      • terminal

        private static org.jline.terminal.Terminal terminal
      • cursorMovementSupported

        private static boolean cursorMovementSupported
    • Constructor Detail

      • TerminalUtils

        public TerminalUtils()
    • Method Detail

      • getTerminalWidth

        static int getTerminalWidth()
      • hasCursorMovementSupport

        static boolean hasCursorMovementSupport()
      • closeTerminal

        static void closeTerminal()
      • filterActiveConsumers

        static <T extends ProgressBarConsumer> java.util.stream.Stream<T> filterActiveConsumers​(java.lang.Class<T> clazz)
      • moveCursorUp

        static java.lang.String moveCursorUp​(int count)
      • moveCursorDown

        static java.lang.String moveCursorDown​(int count)
      • getTerminal

        static org.jline.terminal.Terminal getTerminal()
        • Creating terminal is relatively expensive, usually takes between 5-10ms.
          • If updateInterval is set under 10ms creating new terminal for on every re-render of progress bar could be a problem.
          • Especially when multiple progress bars are running in parallel.
        • Another problem with Terminal is that once created you can create another instance (say from different thread), but this instance will be "dumb". Until previously created terminal will be closed.