Class AnsiProgressHandler

java.lang.Object
com.spotify.docker.client.AnsiProgressHandler
All Implemented Interfaces:
ProgressHandler

public class AnsiProgressHandler extends 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 Details

  • Constructor Details

    • AnsiProgressHandler

      public AnsiProgressHandler()
    • AnsiProgressHandler

      public AnsiProgressHandler(PrintStream out)
  • Method Details

    • progress

      public void progress(ProgressMessage message) throws DockerException
      Description copied from interface: ProgressHandler
      This method will be called for each progress message received from Docker.
      Specified by:
      progress in interface ProgressHandler
      Parameters:
      message - the message to process
      Throws:
      DockerException - if a server error occurred (500)
    • 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