protected static String getSourceBySystem() { if (Platform.isWindows()) { return SRC_WINDOWS_KERNEL_STREAMING; } else if (Platform.isLinux()) { return SRC_VIDEO_FOR_LINUX_2; } else if (Platform.isMac()) { return SRC_QUICKTIME_KIT; } throw new IllegalStateException("Unsupported operating system"); }
if (!Platform.isWindows() && !Platform.isLinux()) { throw new WebcamException(String.format("%s has been designed to work only on Windows and Linux platforms", GStreamerDriver.class.getSimpleName()));
@Override public List<WebcamDevice> getDevices() { List<WebcamDevice> devices = new ArrayList<WebcamDevice>(); final String factory = GsUtils.getCompatibleSourceFactory(); final Element source = ElementFactory.make(factory, "source"); try { if (Platform.isWindows()) { PropertyProbe probe = PropertyProbe.wrap(source); for (Object name : probe.getValues("device-name")) { devices.add(new Gst1Device(name.toString())); } } else if (Platform.isLinux()) { for (File vfile : NixVideoDevUtils.getVideoFiles()) { devices.add(new Gst1Device(vfile)); } } else { throw new RuntimeException("Platform unsupported by GStreamer capture driver"); } } finally { if (source != null) { source.dispose(); } } return devices; }
} else if (Platform.isLinux()) { for (File vfile : NixVideoDevUtils.getVideoFiles()) { devices.add(new GStreamerDevice(this, vfile));
private static 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(); }
else if (Platform.isLinux() || Platform.isFreeBSD()) { if (isVersionedName(libName) || libName.endsWith(".so")) {
} else if (Platform.isLinux() || Platform.isSolaris() || Platform.isAIX() || Platform.isFreeBSD() || Platform.isNetBSD() || Platform.isOpenBSD() || Platform.iskFreeBSD()) {
if ((Platform.isLinux() || Platform.isFreeBSD() || Platform.isAIX()) && Platform.C_LIBRARY_NAME.equals(libraryName)) { libraryName = null;
else if (Platform.isLinux() || Platform.isFreeBSD()) {
addresses.add(PcapIpV6Address.newInstance(pcapAddr, sa_family, name)); } else { if (Platform.isLinux() && sa_family == Inets.AF_PACKET) { sockaddr_ll sll = new sockaddr_ll(pcapAddr.addr.getPointer()); byte[] addr = sll.sll_addr;
|| (Platform.isLinux() && (Platform.isARM() || Platform.isPPC() || Platform.isMIPS())) || Platform.isAIX() || Platform.isAndroid()
protected static String getSourceBySystem() { if (Platform.isWindows()) { return SRC_WINDOWS_KERNEL_STREAMING; } else if (Platform.isLinux()) { return SRC_VIDEO_FOR_LINUX_2; } else if (Platform.isMac()) { return SRC_QUICKTIME_KIT; } throw new IllegalStateException("Unsupported operating system"); }
public static boolean setAddressPreference(DatagramSocket s, SOCKET_ADDR_PREFERENCE p) { if(!Platform.isLinux()) return false; int fd = getFd(s); if(fd <= 2) return false; int ret = -1; try { ret = socketOptionsHolder.setsockopt(fd, SOCKET_level.IPPROTO_IPV6.linux, p.option_name.linux, new IntByReference(p.linux).getPointer(), Pointer.SIZE); } catch(Exception e) { Logger.normal(UdpSocketHandler.class, e.getMessage(),e); } //if it fails that's fine return (ret == 0 ? true : false); } }
public void setOsResponses(boolean windowsResponse, boolean macResponse, boolean linuxResponse) { when(Platform.isWindows()).thenReturn(windowsResponse); when(Platform.isMac()).thenReturn(macResponse); when(Platform.isLinux()).thenReturn(linuxResponse); }
public static DesktopFolders getDesktopFolders() { if (desktopFolders == null) { if (com.sun.jna.Platform.isWindows()) desktopFolders = new WindowsFolders(); if (com.sun.jna.Platform.isMac()) desktopFolders = new OSXFolders(); if (com.sun.jna.Platform.isLinux()) desktopFolders = new LinuxFolders(); if (desktopFolders == null) throw new RuntimeException("OS not supported"); } return desktopFolders; }
@Override protected boolean couldHandleThisVirtualMachine() { final boolean result; if (isFreeBSD() || isLinux() || isOpenBSD() || isSolaris() || isMac()) { result = PROCESS_PID_FIELD != null; } else { result = false; } return result; }
static ScreenAccessor create(boolean isNative) { if (isNative) { if (Platform.isWindows()) { return new WindowsScreenAccessor(); } if (Platform.isLinux()) { return new LinuxScreenAccessor(); } } return new AwtRobotScreenAccessor(); } }
public static JnaNativePty open(Attributes attr, Size size) throws IOException { if (Platform.isMac()) { return OsXNativePty.open(attr, size); } else if (Platform.isLinux()) { return LinuxNativePty.open(attr, size); } else if (Platform.isSolaris()) { return SolarisNativePty.open(attr, size); } else if (Platform.isFreeBSD()) { return FreeBsdNativePty.open(attr, size); } else { throw new UnsupportedOperationException(); } }
public static JnaNativePty current() throws IOException { if (Platform.isMac()) { return OsXNativePty.current(); } else if (Platform.isLinux()) { return LinuxNativePty.current(); } else if (Platform.isSolaris()) { return SolarisNativePty.current(); } else if (Platform.isFreeBSD()) { return FreeBsdNativePty.current(); } else { throw new UnsupportedOperationException(); } }
public static JnaNativePty open(Attributes attr, Size size) throws IOException { if (Platform.isMac()) { return OsXNativePty.open(attr, size); } else if (Platform.isLinux()) { return LinuxNativePty.open(attr, size); } else if (Platform.isSolaris()) { return SolarisNativePty.open(attr, size); } else if (Platform.isFreeBSD()) { return FreeBsdNativePty.open(attr, size); } else { throw new UnsupportedOperationException(); } }