Package com.spotify.docker.client
Class AnsiProgressHandler
- java.lang.Object
-
- com.spotify.docker.client.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
-
Constructor Summary
Constructors Constructor Description AnsiProgressHandler()
AnsiProgressHandler(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.
-
-
-
Field Detail
-
ESC_CODE
private static final char ESC_CODE
- See Also:
- Constant Field Values
-
out
private final java.io.PrintStream out
-
idsToLines
private final java.util.Map<java.lang.String,java.lang.Integer> idsToLines
-
-
Method Detail
-
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 interfaceProgressHandler
- 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
-
-