本文整理汇总了Java中org.apache.commons.validator.routines.InetAddressValidator.isValidInet4Address方法的典型用法代码示例。如果您正苦于以下问题:Java InetAddressValidator.isValidInet4Address方法的具体用法?Java InetAddressValidator.isValidInet4Address怎么用?Java InetAddressValidator.isValidInet4Address使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.validator.routines.InetAddressValidator
的用法示例。
在下文中一共展示了InetAddressValidator.isValidInet4Address方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isValidIpAddress
import org.apache.commons.validator.routines.InetAddressValidator; //导入方法依赖的package包/类
private boolean isValidIpAddress(String serverIP) {
InetAddressValidator validator = new InetAddressValidator();
return (validator.isValidInet4Address(serverIP) /*
* || validator.
* isValidInet6Address
* (serverIP)
*/);
}
示例2: isValidIp4
import org.apache.commons.validator.routines.InetAddressValidator; //导入方法依赖的package包/类
public static boolean isValidIp4(final String ip) {
if (ip == null) {
return false;
}
final InetAddressValidator validator = InetAddressValidator.getInstance();
return validator.isValidInet4Address(ip);
}
示例3: isValidIp4
import org.apache.commons.validator.routines.InetAddressValidator; //导入方法依赖的package包/类
public static boolean isValidIp4(final String ip) {
if (ip == null)
return false;
final InetAddressValidator validator = InetAddressValidator.getInstance();
return validator.isValidInet4Address(ip);
}
示例4: createArgs
import org.apache.commons.validator.routines.InetAddressValidator; //导入方法依赖的package包/类
@Override protected ImmutableList<String> createArgs() {
List<String> argList = new ArrayList<>();
checkAppiumJS();
argList.add(appiumJS.getAbsolutePath());
argList.add("--port");
argList.add(String.valueOf(getPort()));
if (StringUtils.isBlank(ipAddress)) {
ipAddress = DEFAULT_LOCAL_IP_ADDRESS;
} else {
InetAddressValidator validator = InetAddressValidator.getInstance();
if (!validator.isValid(ipAddress) && !validator.isValidInet4Address(ipAddress)
&& !validator.isValidInet6Address(ipAddress)) {
throw new IllegalArgumentException(
"The invalid IP address " + ipAddress + " is defined");
}
}
argList.add("--address");
argList.add(ipAddress);
File log = getLogFile();
if (log != null) {
argList.add("--log");
argList.add(log.getAbsolutePath());
}
Set<Map.Entry<String, String>> entries = serverArguments.entrySet();
for (Map.Entry<String, String> entry : entries) {
String argument = entry.getKey();
String value = entry.getValue();
if (StringUtils.isBlank(argument) || value == null) {
continue;
}
argList.add(argument);
if (!StringUtils.isBlank(value)) {
argList.add(value);
}
}
if (capabilities != null) {
argList.add("--default-capabilities");
argList.add(parseCapabilities());
}
return new ImmutableList.Builder<String>().addAll(argList).build();
}