本文整理汇总了Java中com.sun.jna.Platform.isOpenBSD方法的典型用法代码示例。如果您正苦于以下问题:Java Platform.isOpenBSD方法的具体用法?Java Platform.isOpenBSD怎么用?Java Platform.isOpenBSD使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.jna.Platform
的用法示例。
在下文中一共展示了Platform.isOpenBSD方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPlatformFolder
import com.sun.jna.Platform; //导入方法依赖的package包/类
private static String getPlatformFolder() {
String result;
if (Platform.isMac()) {
result = "macosx";
} else if (Platform.isWindows()) {
result = "win";
} else if (Platform.isLinux()) {
result = "linux";
} else if (Platform.isFreeBSD()) {
result = "freebsd";
} else if (Platform.isOpenBSD()) {
result = "openbsd";
} else {
throw new IllegalStateException("Platform " + Platform.getOSType() + " is not supported");
}
return result;
}
示例2: getUnixUID
import com.sun.jna.Platform; //导入方法依赖的package包/类
/**
* Gets the user ID on Unix based systems. This should not change during a
* session and the lookup is expensive, so we cache the result.
*
* @return The Unix user ID
* @throws IOException
*/
public static int getUnixUID() throws IOException {
if (
Platform.isAIX() || Platform.isFreeBSD() || Platform.isGNU() || Platform.iskFreeBSD() ||
Platform.isLinux() || Platform.isMac() || Platform.isNetBSD() || Platform.isOpenBSD() ||
Platform.isSolaris()
) {
synchronized (unixUIDLock) {
if (unixUID < 0) {
String response;
Process id;
id = Runtime.getRuntime().exec("id -u");
try (BufferedReader reader = new BufferedReader(new InputStreamReader(id.getInputStream(), Charset.defaultCharset()))) {
response = reader.readLine();
}
try {
unixUID = Integer.parseInt(response);
} catch (NumberFormatException e) {
throw new UnsupportedOperationException("Unexpected response from OS: " + response, e);
}
}
return unixUID;
}
}
throw new UnsupportedOperationException("getUnixUID can only be called on Unix based OS'es");
}
示例3: getPlatformFolder
import com.sun.jna.Platform; //导入方法依赖的package包/类
private static String getPlatformFolder() {
String result;
if (Platform.isMac()) {
result = "macosx";
} else if (Platform.isWindows()) {
result = "win";
} else if (Platform.isLinux()) {
result = "linux";
} else if (Platform.isFreeBSD()) {
result = "freebsd";
} else if (Platform.isOpenBSD()) {
result = "openbsd";
} else {
throw new IllegalStateException("Platform " + Platform.getOSType() + " is not supported");
}
return result;
}
示例4: getNativeLibraryName
import com.sun.jna.Platform; //导入方法依赖的package包/类
private static String getNativeLibraryName() {
String result;
if (Platform.isMac()) {
result = "libpty.dylib";
} else if (Platform.isWindows()) {
result = "winpty.dll";
} else if (Platform.isLinux() || Platform.isFreeBSD() || Platform.isOpenBSD()) {
result = "libpty.so";
} else {
throw new IllegalStateException("Platform " + Platform.getOSType() + " is not supported");
}
return result;
}
示例5: isBsdish
import com.sun.jna.Platform; //导入方法依赖的package包/类
private static boolean isBsdish() {
return Platform.isMac()
|| Platform.isFreeBSD()
|| Platform.isNetBSD()
|| Platform.isOpenBSD()
|| Platform.iskFreeBSD();
}
示例6: getNativeLibraryName
import com.sun.jna.Platform; //导入方法依赖的package包/类
private static String getNativeLibraryName() {
String result;
if (Platform.isMac()) {
result = "libpty.dylib";
} else if (Platform.isWindows()) {
result = "winpty.dll";
} else if (Platform.isLinux() || Platform.isFreeBSD() || Platform.isOpenBSD()) {
result = "libpty.so";
} else {
throw new IllegalStateException("Platform " + Platform.getOSType() + " is not supported");
}
return result;
}
示例7: preparePingCommand
import com.sun.jna.Platform; //导入方法依赖的package包/类
private String[] preparePingCommand(int count) {
String value = Integer.toString(count);
if (Platform.isWindows()) {
return new String[]{"ping", "-n", value, "127.0.0.1"};
} else if (Platform.isSolaris()) {
return new String[]{"/usr/sbin/ping", "-s", "127.0.0.1", "64", value};
} else if (Platform.isMac() || Platform.isFreeBSD() || Platform.isOpenBSD()) {
return new String[]{"/sbin/ping", "-c", value, "127.0.0.1"};
} else if (Platform.isLinux()) {
return new String[]{"/bin/ping", "-c", value, "127.0.0.1"};
}
throw new RuntimeException("Unsupported platform!");
}
示例8: getClassPrefix
import com.sun.jna.Platform; //导入方法依赖的package包/类
private static String getClassPrefix() {
return Platform.isWindows() ? "Win32"
: Platform.isSolaris() ? "Sun"
: (Platform.isMac() || Platform.isFreeBSD() || Platform.isOpenBSD()) ? "BSD"
: "Unix";
}