Package com.github.mike10004.xvfbmanager
Interface XvfbController
-
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
DefaultXvfbController
public interface XvfbController extends Closeable
Interface for a class that controls a virtual framebuffer process.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classXvfbController.XWindowClass representing information about a window rendered by an X server.
-
Field Summary
Fields Modifier and Type Field Description static StringENV_DISPLAY
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Map<String,String>configureEnvironment(Map<String,String> environment)Sets the display environment variable in the given environment.StringgetDisplay()Gets the display number in the format:NwhereNis the display number.Screenshooter<?>getScreenshooter()Captures a screenshot of the virtual framebuffer.Map<String,String>newEnvironment()Creates a new, mutable environment variable map with the display variable set.Optional<TreeNode<XvfbController.XWindow>>pollForWindow(Predicate<XvfbController.XWindow> windowFinder, long intervalMs, int maxPollAttempts)voidstop()Stops the virtual framebuffer process.voidwaitUntilReady()Waits until the display is ready, using default values for the polling interval and maximum polls.voidwaitUntilReady(long pollIntervalMs, int maxNumPolls)Waits until the X display is ready, polling at a given interval until the display is ready or the given number of polls has been executed.
-
-
-
Field Detail
-
ENV_DISPLAY
static final String ENV_DISPLAY
- See Also:
- Constant Field Values
-
-
Method Detail
-
waitUntilReady
void waitUntilReady() throws InterruptedExceptionWaits until the display is ready, using default values for the polling interval and maximum polls. Implementations may select the defaults to use.- Throws:
InterruptedException- if waiting is interrupted- See Also:
waitUntilReady(long, int)
-
waitUntilReady
void waitUntilReady(long pollIntervalMs, int maxNumPolls) throws InterruptedExceptionWaits until the X display is ready, polling at a given interval until the display is ready or the given number of polls has been executed.- Parameters:
pollIntervalMs- interval between polls in millisecondsmaxNumPolls- maximum number of polls to execute- Throws:
InterruptedException- if waiting is interrupted
-
stop
void stop()
Stops the virtual framebuffer process.
-
getDisplay
String getDisplay()
Gets the display number in the format:NwhereNis the display number.- Returns:
- the display
-
configureEnvironment
Map<String,String> configureEnvironment(Map<String,String> environment)
Sets the display environment variable in the given environment.- Parameters:
environment- map of environment variables in which display is to be set- Returns:
- the argument environment object
- See Also:
ENV_DISPLAY
-
newEnvironment
Map<String,String> newEnvironment()
Creates a new, mutable environment variable map with the display variable set.- Returns:
- the new environment map
- See Also:
configureEnvironment(Map)
-
getScreenshooter
Screenshooter<?> getScreenshooter() throws XvfbException
Captures a screenshot of the virtual framebuffer.- Returns:
- the screenshot
- Throws:
XvfbException- if screenshooting goes awry
-
pollForWindow
Optional<TreeNode<XvfbController.XWindow>> pollForWindow(Predicate<XvfbController.XWindow> windowFinder, long intervalMs, int maxPollAttempts) throws InterruptedException
- Throws:
InterruptedException
-
-