當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。