Class DefaultProgressBarRenderer

    • Field Detail

      • unitName

        private java.lang.String unitName
      • unitSize

        private long unitSize
      • isSpeedShown

        private boolean isSpeedShown
      • speedFormat

        private java.text.DecimalFormat speedFormat
      • speedUnit

        private java.time.temporal.ChronoUnit speedUnit
      • isEtaShown

        private boolean isEtaShown
      • eta

        private java.util.function.Function<ProgressState,​java.util.Optional<java.time.Duration>> eta
    • Constructor Detail

      • DefaultProgressBarRenderer

        protected DefaultProgressBarRenderer​(ProgressBarStyle style,
                                             java.lang.String unitName,
                                             long unitSize,
                                             boolean isSpeedShown,
                                             java.text.DecimalFormat speedFormat,
                                             java.time.temporal.ChronoUnit speedUnit,
                                             boolean isEtaShown,
                                             java.util.function.Function<ProgressState,​java.util.Optional<java.time.Duration>> eta)
    • Method Detail

      • progressIntegralPart

        protected int progressIntegralPart​(ProgressState progress,
                                           int length)
      • progressFractionalPart

        protected int progressFractionalPart​(ProgressState progress,
                                             int length)
      • etaString

        protected java.lang.String etaString​(ProgressState progress)
      • percentage

        protected java.lang.String percentage​(ProgressState progress)
      • ratio

        protected java.lang.String ratio​(ProgressState progress)
      • speed

        protected java.lang.String speed​(ProgressState progress)
      • render

        public java.lang.String render​(ProgressState progress,
                                       int maxLength)
        Description copied from interface: ProgressBarRenderer
        Renders the current progress bar state as a string to be shown by a consumer.
        Specified by:
        render in interface ProgressBarRenderer
        Parameters:
        progress - The current progress bar state
        maxLength - The maximum length as dictated by the consumer
        Returns:
        Rendered string to be consumed by the consumer