本文整理汇总了Java中com.sun.jna.Platform.isFreeBSD方法的典型用法代码示例。如果您正苦于以下问题:Java Platform.isFreeBSD方法的具体用法?Java Platform.isFreeBSD怎么用?Java Platform.isFreeBSD使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.jna.Platform
的用法示例。
在下文中一共展示了Platform.isFreeBSD方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getImplInstance
import com.sun.jna.Platform; //导入方法依赖的package包/类
private static final NativeCalls getImplInstance() {
if (Platform.isLinux()) {
return new LinuxNativeCalls();
}
if (Platform.isWindows()) {
return new WinNativeCalls();
}
if (Platform.isSolaris()) {
return new SolarisNativeCalls();
}
if (Platform.isMac()) {
return new MacOSXNativeCalls();
}
if (Platform.isFreeBSD()) {
return new FreeBSDNativeCalls();
}
return new POSIXNativeCalls();
}
示例2: 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;
}
示例3: 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");
}
示例4: getPipeProcess
import com.sun.jna.Platform; //导入方法依赖的package包/类
public ProcessWrapper getPipeProcess() {
if (!Platform.isWindows()) {
OutputParams mkfifo_vid_params = new OutputParams(configuration);
mkfifo_vid_params.maxBufferSize = 0.1;
mkfifo_vid_params.log = true;
String cmdArray[];
if (Platform.isMac() || Platform.isFreeBSD() || Platform.isSolaris()) {
cmdArray = new String[] {"mkfifo", "-m", "777", linuxPipeName};
} else {
cmdArray = new String[] {"mkfifo", "--mode=777", linuxPipeName};
}
ProcessWrapperImpl mkfifo_vid_process = new ProcessWrapperImpl(cmdArray, mkfifo_vid_params);
return mkfifo_vid_process;
}
return mk;
}
示例5: 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;
}
示例6: mapSharedLibraryName
import com.sun.jna.Platform; //导入方法依赖的package包/类
static String mapSharedLibraryName(String libName) {
if (Platform.isMac()) {
if (libName.startsWith("lib")
&& (libName.endsWith(".dylib")
|| libName.endsWith(".jnilib"))) {
return libName;
}
String name = System.mapLibraryName(libName);
// On MacOSX, System.mapLibraryName() returns the .jnilib extension
// (the suffix for JNI libraries); ordinarily shared libraries have
// a .dylib suffix
if (name.endsWith(".jnilib")) {
return name.substring(0, name.lastIndexOf(".jnilib")) + ".dylib";
}
return name;
}
else if (Platform.isLinux() || Platform.isFreeBSD()) {
if (isVersionedName(libName) || libName.endsWith(".so")) {
// A specific version was requested - use as is for search
return libName;
}
}
else if (Platform.isAIX()) { // can be libx.a, libx.a(shr.o), libx.so
if (libName.startsWith("lib")) {
return libName;
}
}
else if (Platform.isWindows()) {
if (libName.endsWith(".drv") || libName.endsWith(".dll")) {
return libName;
}
}
return System.mapLibraryName(libName);
}
示例7: 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;
}
示例8: isBsdish
import com.sun.jna.Platform; //导入方法依赖的package包/类
private static boolean isBsdish() {
return Platform.isMac()
|| Platform.isFreeBSD()
|| Platform.isNetBSD()
|| Platform.isOpenBSD()
|| Platform.iskFreeBSD();
}
示例9: 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;
}
示例10: 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!");
}
示例11: 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";
}