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


Java Platform.isSolaris方法代码示例

本文整理汇总了Java中com.sun.jna.Platform.isSolaris方法的典型用法代码示例。如果您正苦于以下问题:Java Platform.isSolaris方法的具体用法?Java Platform.isSolaris怎么用?Java Platform.isSolaris使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.jna.Platform的用法示例。


在下文中一共展示了Platform.isSolaris方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
 
开发者ID:ampool,项目名称:monarch,代码行数:19,代码来源:NativeCallsJNAImpl.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: 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;
}
 
开发者ID:DigitalMediaServer,项目名称:DigitalMediaServer,代码行数:20,代码来源:PipeProcess.java

示例4: createInstance

import com.sun.jna.Platform; //导入方法依赖的package包/类
protected static BasicSystemUtils createInstance() {
	if (Platform.isWindows()) {
		return new WinUtils();
	}
	if (Platform.isMac()) {
		return new MacSystemUtils();
	}
	if (Platform.isSolaris()) {
		return new SolarisUtils();
	}
	return new BasicSystemUtils();
}
 
开发者ID:DigitalMediaServer,项目名称:DigitalMediaServer,代码行数:13,代码来源:BasicSystemUtils.java

示例5: 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

示例6: Mavkit

import com.sun.jna.Platform; //导入方法依赖的package包/类
public Mavkit(String[] args) {
	Thread.currentThread().setName("Main thread");
	OptionParser op = new OptionParser();
	
	op.accepts("use-bare-directories", "Force usage of \"bare\" directories, instead of choosing the best provider based on the operating system");
	OptionSpec<?> help = op.acceptsAll(Arrays.asList("help", "h", "?"), "Display this help").forHelp();
	
	OptionSet os = op.parse(args);
	if (os.has(help)) {
		try {
			op.printHelpOn(System.err);
		} catch (IOException e1) {
			e1.printStackTrace();
		}
		System.exit(0);
	}
	
	log.info("Starting Mavkit");
	
	Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {
		@Override
		// Checker Framework doesn't understand a few things about JOptionPane
		@SuppressWarnings({"argument.type.incompatible", "call.invalid.ui"})
		public void uncaughtException(Thread t, Throwable e) {
			try {
				if (e instanceof Panic) {
					log.error("Panic!", e);
					setLaF();
					JOptionPane.showMessageDialog(null, I18n.get("dialog.panic.title")+e.getLocalizedMessage(), I18n.get("window.title"), JOptionPane.ERROR_MESSAGE, null);
					System.exit(2);
				} else {
					log.error("{} died", t.getName(), e);
					if ("Main thread".equals(t.getName())
							|| "UI thread".equals(t.getName())
							|| "Audio thread".equals(t.getName())) {
						setLaF();
						JOptionPane.showMessageDialog(null, I18n.get("dialog.error.title")+Throwables.getStackTraceAsString(e), I18n.get("window.title"), JOptionPane.ERROR_MESSAGE, null);
						System.exit(1);
					}
				}
			} catch (Exception ex) {
				Throwables.propagate(ex);
			}
		}
	});

	display = new Display();
	interfaceRenderer = new InterfaceRenderer();
	audioProcessor = new AudioProcessor();
	
	String appName = I18n.getDefault("application.name");
	String cleanAppName = appName.toLowerCase(Locale.ROOT).replaceAll("[^a-z0-9]", "-");
	
	if (os.has("use-bare-directories")) {
		directories = new BareDirectories(cleanAppName);
		log.info("Using bare directories, as requested");
	} else {
		if (Platform.isLinux() || Platform.isX11() || Platform.isSolaris() || Platform.isAIX()) {
			directories = new XDGDirectories(cleanAppName);
			log.info("Using XDG directories");
		} else if (Platform.isMac()) {
			directories = new MacDirectories(appName.replace('/', '_'));
			log.info("Using Mac Library directories");
		} else if (Platform.isWindows()) {
			directories = new WindowsDirectories(appName.replace('/', '_').replace(" ", ""));
			log.info("Using Windows directories");
		} else {
			directories = new BareDirectories(cleanAppName);
			log.info("Using bare directories");
		}
	}
	
}
 
开发者ID:mav-assistant,项目名称:Mavkit,代码行数:74,代码来源:Mavkit.java

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