Class AnsiProgressHandler

  • All Implemented Interfaces:
    ProgressHandler

    public class AnsiProgressHandler
    extends java.lang.Object
    implements ProgressHandler
    Parses ProgressMessage objects and writes the output to a PrintStream. The output includes ANSI escape characters to move the cursor around to nicely print progress bars.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static char ESC_CODE  
      private java.util.Map<java.lang.String,​java.lang.Integer> idsToLines  
      private java.io.PrintStream out  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void printProgress​(ProgressMessage message)
      Displays the upload/download status of multiple image layers the same way the docker CLI does.
      void progress​(ProgressMessage message)
      This method will be called for each progress message received from Docker.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • out

        private final java.io.PrintStream out
      • idsToLines

        private final java.util.Map<java.lang.String,​java.lang.Integer> idsToLines
    • Constructor Detail

      • AnsiProgressHandler

        public AnsiProgressHandler()
      • AnsiProgressHandler

        public AnsiProgressHandler​(java.io.PrintStream out)
    • Method Detail

      • printProgress

        private void printProgress​(ProgressMessage message)
        Displays the upload/download status of multiple image layers the same way the docker CLI does. The current status of each layer is show on its own line. As the status updated, we move the cursor to the correct line, and overwrite the old status with the new one.
        Parameters:
        message - the ProgressMessage to parse