com.github.mike10004.xvfbmanager.XvfbConfig Maven / Gradle / Ivy
The newest version!
package com.github.mike10004.xvfbmanager;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Configuration for Xvfb execution.
*/
public class XvfbConfig {
/**
* Geometry of the screen. This value is specified in the
* {@code -screen 0 } option. The syntax is
* W{@code x}H{@code x}D, where W and H
* are positive integer width and height values, respectively,
* and D is a depth value. Supported values for D include
* "8", "24", and "24+32". A fine choice for this field is
* {@code 1280x1024x8} or {@code 1280x1024x24+32}.
*/
public final String geometry;
public XvfbConfig(String geometry) {
this.geometry = checkNotNull(geometry);
checkArgument(geometry.matches("\\d+x\\d+x\\d+(?:\\+32)?"), "argument must have form WxHxD where W=width, H=height, and D=depth; default is 1280x1024x24+32");
}
@Override
public String toString() {
return "XvfbConfig{" +
"geometry='" + geometry + '\'' +
'}';
}
private static final XvfbConfig DEFAULT = new XvfbConfig("1280x1024x24+32");
/**
* Default configuration instance. This differs from the {@code 1280x1024x8} configuration that {@code Xvfb}
* uses by default, stated in the manual.
*/
public static XvfbConfig getDefault() {
return DEFAULT;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy