当前位置: 首页>>代码示例>>Java>>正文


Java Platform.isOpenBSD方法代码示例

本文整理汇总了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;
}
 
开发者ID:Coding,项目名称:WebIDE-Backend,代码行数:20,代码来源:PtyUtil.java

示例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");
}
 
开发者ID:DigitalMediaServer,项目名称:DigitalMediaServer,代码行数:33,代码来源:FileUtil.java

示例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;
}
 
开发者ID:traff,项目名称:pty4j,代码行数:20,代码来源:PtyUtil.java

示例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;
}
 
开发者ID:Coding,项目名称:WebIDE-Backend,代码行数:16,代码来源:PtyUtil.java

示例5: isBsdish

import com.sun.jna.Platform; //导入方法依赖的package包/类
private static boolean isBsdish() {
  return Platform.isMac()
      || Platform.isFreeBSD()
      || Platform.isNetBSD()
      || Platform.isOpenBSD()
      || Platform.iskFreeBSD();
}
 
开发者ID:facebook,项目名称:buck,代码行数:8,代码来源:UnixDomainSocketLibrary.java

示例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;
}
 
开发者ID:traff,项目名称:pty4j,代码行数:16,代码来源:PtyUtil.java

示例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!");
}
 
开发者ID:traff,项目名称:pty4j,代码行数:15,代码来源:PtyTest.java

示例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";
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:7,代码来源:NativeDatagramSocket.java


注:本文中的com.sun.jna.Platform.isOpenBSD方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。