Codota Logo
Platform$OS
Code IndexAdd Codota to your IDE (free)

How to use
Platform$OS
in
jnr.ffi

Best Java code snippets using jnr.ffi.Platform$OS (Showing top 14 results out of 315)

  • Common ways to obtain Platform$OS
private void myMethod () {
Platform$OS p =
  • Codota IconPlatform.getNativePlatform().getOS()
  • Codota IconPlatform platform;platform.getOS()
  • Smart code suggestions by Codota
}
origin: com.github.jnr/jnr-netdb

private static final File locateProtocolsFile() {
  if (Platform.getNativePlatform().getOS().equals(WINDOWS)) {
    String systemRoot;
    try {
      // FIXME: %SystemRoot% is typically *not* present in Java env,
      // so we need a better way to obtain the Windows location.
      // One possible solution: Win32API's SHGetFolderPath() with
      // parameter CSIDL_SYSTEM or CSIDL_WINDOWS.
      systemRoot = System.getProperty("SystemRoot", "C:\\windows");
    } catch (SecurityException se) {
      // whoops, try the most logical one
      systemRoot = "C:\\windows";
    }
    return new File(systemRoot + "\\system32\\drivers\\etc\\protocol");
  } else {
    return new File("/etc/protocols");
  }
}
origin: com.facebook.presto.cassandra/cassandra-driver

  @Override
  public String toString() {
    return name().toLowerCase(LOCALE);
  }
}
origin: com.cloudbees.util/jnr-unixsocket-nodep

private static NativeType[] buildNativeTypeAliases() {
  Platform platform = Platform.getNativePlatform();
  Package pkg = NativeRuntime.class.getPackage();
  String cpu = platform.getCPU().toString();
  String os = platform.getOS().toString();
  EnumSet<TypeAlias> typeAliases = EnumSet.allOf(TypeAlias.class);
  NativeType[] aliases = {};
  Class cls;
  try {
    cls = Class.forName(pkg.getName() + ".platform." + cpu + "." + os + ".TypeAliases");
    Field aliasesField = cls.getField("ALIASES");
    Map aliasMap = Map.class.cast(aliasesField.get(cls));
    aliases = new NativeType[typeAliases.size()];
    for (TypeAlias t : typeAliases) {
      aliases[t.ordinal()] = (NativeType) aliasMap.get(t);
      if (aliases[t.ordinal()] == null) {
        aliases[t.ordinal()] = NativeType.VOID;
      }
    }
  } catch (ClassNotFoundException cne) {
    Logger.getLogger(NativeRuntime.class.getName()).log(Level.SEVERE, "failed to load type aliases: " + cne);
  } catch (NoSuchFieldException nsfe) {
    Logger.getLogger(NativeRuntime.class.getName()).log(Level.SEVERE, "failed to load type aliases: " + nsfe);
  } catch (IllegalAccessException iae) {
    Logger.getLogger(NativeRuntime.class.getName()).log(Level.SEVERE, "failed to load type aliases: " + iae);
  }
  return aliases;
}
origin: embulk/embulk-input-jdbc

  private static String convert(String sql)
  {
    if (Platform.getNativePlatform().getOS().equals(OS.WINDOWS)) {
      // '"' should be '\"' and '\' should be '\\' in Windows
      return sql.replace("\\\\", "\\").replace("\\", "\\\\").replace("\"", "\\\"");
    }
    return sql;
  }
}
origin: com.github.jnr/jnr-posix

public FromNativeConverter getFromNativeConverter(Class klazz) {
  if (Passwd.class.isAssignableFrom(klazz)) {
    if (Platform.IS_MAC) {
      return MacOSPOSIX.PASSWD;
    } else if (Platform.IS_LINUX) {
      return LinuxPOSIX.PASSWD;
    } else if (Platform.IS_SOLARIS) {
      return SolarisPOSIX.PASSWD;
    } else if (Platform.IS_FREEBSD) {
      return FreeBSDPOSIX.PASSWD;
    } else if (Platform.IS_OPENBSD) {
      return OpenBSDPOSIX.PASSWD;
    } else if (Platform.IS_WINDOWS) {
      return WindowsPOSIX.PASSWD;
    } else if (jnr.ffi.Platform.getNativePlatform().getOS().equals(jnr.ffi.Platform.OS.AIX)) {
      return AixPOSIX.PASSWD;
    }
    return null;
  } else if (Group.class.isAssignableFrom(klazz)) {
    return BaseNativePOSIX.GROUP;
  } else if (HANDLE.class.isAssignableFrom(klazz)) {
    return HANDLE.Converter;
  }
  
  return null;
}

origin: com.facebook.presto.cassandra/cassandra-driver

public FromNativeConverter getFromNativeConverter(Class klazz) {
  if (Passwd.class.isAssignableFrom(klazz)) {
    if (Platform.IS_MAC) {
      return MacOSPOSIX.PASSWD;
    } else if (Platform.IS_LINUX) {
      return LinuxPOSIX.PASSWD;
    } else if (Platform.IS_SOLARIS) {
      return SolarisPOSIX.PASSWD;
    } else if (Platform.IS_FREEBSD) {
      return FreeBSDPOSIX.PASSWD;
    } else if (Platform.IS_OPENBSD) {
      return OpenBSDPOSIX.PASSWD;
    } else if (Platform.IS_WINDOWS) {
      return WindowsPOSIX.PASSWD;
    } else if (jnr.ffi.Platform.getNativePlatform().getOS().equals(jnr.ffi.Platform.OS.AIX)) {
      return AixPOSIX.PASSWD;
    }
    return null;
  } else if (Group.class.isAssignableFrom(klazz)) {
    return BaseNativePOSIX.GROUP;
  } else if (HANDLE.class.isAssignableFrom(klazz)) {
    return HANDLE.Converter;
  }
  
  return null;
}

origin: io.prestosql.cassandra/cassandra-driver

  @Override
  public String toString() {
    return name().toLowerCase(LOCALE);
  }
}
origin: com.cloudbees.util/jnr-unixsocket-nodep

public FromNativeConverter getFromNativeConverter(Class klazz) {
  if (Passwd.class.isAssignableFrom(klazz)) {
    if (Platform.IS_MAC) {
      return MacOSPOSIX.PASSWD;
    } else if (Platform.IS_LINUX) {
      return LinuxPOSIX.PASSWD;
    } else if (Platform.IS_SOLARIS) {
      return SolarisPOSIX.PASSWD;
    } else if (Platform.IS_FREEBSD) {
      return FreeBSDPOSIX.PASSWD;
    } else if (Platform.IS_OPENBSD) {
      return OpenBSDPOSIX.PASSWD;
    } else if (Platform.IS_WINDOWS) {
      return WindowsPOSIX.PASSWD;
    } else if (jnr.ffi.Platform.getNativePlatform().getOS().equals(jnr.ffi.Platform.OS.AIX)) {
      return AixPOSIX.PASSWD;
    }
    return null;
  } else if (Group.class.isAssignableFrom(klazz)) {
    return BaseNativePOSIX.GROUP;
  } else if (HANDLE.class.isAssignableFrom(klazz)) {
    return HANDLE.Converter;
  }
  
  return null;
}

origin: com.facebook.presto.cassandra/cassandra-driver

private static NativeType[] buildNativeTypeAliases() {
  Platform platform = Platform.getNativePlatform();
  Package pkg = NativeRuntime.class.getPackage();
  String cpu = platform.getCPU().toString();
  String os = platform.getOS().toString();
  EnumSet<TypeAlias> typeAliases = EnumSet.allOf(TypeAlias.class);
  NativeType[] aliases = {};
  Class cls;
  try {
    cls = Class.forName(pkg.getName() + ".platform." + cpu + "." + os + ".TypeAliases");
    Field aliasesField = cls.getField("ALIASES");
    Map aliasMap = Map.class.cast(aliasesField.get(cls));
    aliases = new NativeType[typeAliases.size()];
    for (TypeAlias t : typeAliases) {
      aliases[t.ordinal()] = (NativeType) aliasMap.get(t);
      if (aliases[t.ordinal()] == null) {
        aliases[t.ordinal()] = NativeType.VOID;
      }
    }
  } catch (ClassNotFoundException cne) {
    Logger.getLogger(NativeRuntime.class.getName()).log(Level.SEVERE, "failed to load type aliases: " + cne);
  } catch (NoSuchFieldException nsfe) {
    Logger.getLogger(NativeRuntime.class.getName()).log(Level.SEVERE, "failed to load type aliases: " + nsfe);
  } catch (IllegalAccessException iae) {
    Logger.getLogger(NativeRuntime.class.getName()).log(Level.SEVERE, "failed to load type aliases: " + iae);
  }
  return aliases;
}
origin: io.prestosql.cassandra/cassandra-driver

private static NativeType[] buildNativeTypeAliases() {
  Platform platform = Platform.getNativePlatform();
  Package pkg = NativeRuntime.class.getPackage();
  String cpu = platform.getCPU().toString();
  String os = platform.getOS().toString();
  EnumSet<TypeAlias> typeAliases = EnumSet.allOf(TypeAlias.class);
  NativeType[] aliases = {};
  Class cls;
  try {
    cls = Class.forName(pkg.getName() + ".platform." + cpu + "." + os + ".TypeAliases");
    Field aliasesField = cls.getField("ALIASES");
    Map aliasMap = Map.class.cast(aliasesField.get(cls));
    aliases = new NativeType[typeAliases.size()];
    for (TypeAlias t : typeAliases) {
      aliases[t.ordinal()] = (NativeType) aliasMap.get(t);
      if (aliases[t.ordinal()] == null) {
        aliases[t.ordinal()] = NativeType.VOID;
      }
    }
  } catch (ClassNotFoundException cne) {
    Logger.getLogger(NativeRuntime.class.getName()).log(Level.SEVERE, "failed to load type aliases: " + cne);
  } catch (NoSuchFieldException nsfe) {
    Logger.getLogger(NativeRuntime.class.getName()).log(Level.SEVERE, "failed to load type aliases: " + nsfe);
  } catch (IllegalAccessException iae) {
    Logger.getLogger(NativeRuntime.class.getName()).log(Level.SEVERE, "failed to load type aliases: " + iae);
  }
  return aliases;
}
origin: com.github.jnr/jnr-netdb

if (!(os.equals(DARWIN) || (os.equals(WINDOWS) && Platform.getNativePlatform().getCPU() == Platform.CPU.I386)
    || os.equals(LINUX) || os.equals(SOLARIS)
    || os.equals(FREEBSD) || os.equals(NETBSD))) {
  return null;
if (os.equals(WINDOWS)) {
  Map<LibraryOption, Object> options = new HashMap<LibraryOption, Object>();
  options.put(LibraryOption.CallingConvention, CallingConvention.STDCALL);
  lib = Library.loadLibrary(LibProto.class, options, "Ws2_32");
} else {
  String[] libnames = os.equals(SOLARIS)
      ? new String[]{"socket", "nsl", "c"}
      : new String[]{"c"};
  lib = os.equals(LINUX)
    ? Library.loadLibrary(LinuxLibProto.class, libnames)
    : Library.loadLibrary(LibProto.class, libnames);
NativeProtocolsDB protocolsDB = os.equals(LINUX)
    ? new LinuxNativeProtocolsDB((LinuxLibProto) lib)
    : new DefaultNativeProtocolsDB(lib);
origin: com.cloudbees.util/jnr-unixsocket-nodep

  @Override
  public String toString() {
    return name().toLowerCase(LOCALE);
  }
}
origin: com.github.jnr/jnr-netdb

if (!(os.equals(DARWIN) || (os.equals(WINDOWS) && Platform.getNativePlatform().getCPU() == Platform.CPU.I386)
    || os.equals(LINUX) || os.equals(SOLARIS)
    || os.equals(FREEBSD) || os.equals(NETBSD))) {
  return null;
if (os.equals(WINDOWS)) {
  Map<LibraryOption, Object> options = new HashMap<LibraryOption, Object>();
  options.put(LibraryOption.CallingConvention, CallingConvention.STDCALL);
  String[] libnames = os.equals(SOLARIS)
    ? new String[] { "socket", "nsl", "c" }
    : new String[] { "c" };
  if (os.equals(LINUX)) {
    lib = Library.loadLibrary(LinuxLibServices.class, libnames);
  } else {
NativeServicesDB services = os.equals(LINUX)
    ? new LinuxServicesDB(lib)
    : new DefaultNativeServicesDB(lib);
origin: io.prestosql.cassandra/cassandra-driver

public FromNativeConverter getFromNativeConverter(Class klazz) {
  if (Passwd.class.isAssignableFrom(klazz)) {
    if (Platform.IS_MAC) {
      return MacOSPOSIX.PASSWD;
    } else if (Platform.IS_LINUX) {
      return LinuxPOSIX.PASSWD;
    } else if (Platform.IS_SOLARIS) {
      return SolarisPOSIX.PASSWD;
    } else if (Platform.IS_FREEBSD) {
      return FreeBSDPOSIX.PASSWD;
    } else if (Platform.IS_OPENBSD) {
      return OpenBSDPOSIX.PASSWD;
    } else if (Platform.IS_WINDOWS) {
      return WindowsPOSIX.PASSWD;
    } else if (jnr.ffi.Platform.getNativePlatform().getOS().equals(jnr.ffi.Platform.OS.AIX)) {
      return AixPOSIX.PASSWD;
    }
    return null;
  } else if (Group.class.isAssignableFrom(klazz)) {
    return BaseNativePOSIX.GROUP;
  } else if (HANDLE.class.isAssignableFrom(klazz)) {
    return HANDLE.Converter;
  }
  
  return null;
}

jnr.ffiPlatform$OS

Javadoc

The common names of supported operating systems.

Most used methods

  • equals
  • name
  • toString

Popular in Java

  • Making http requests using okhttp
  • getApplicationContext (Context)
  • getSystemService (Context)
  • requestLocationUpdates (LocationManager)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • JFrame (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now