Package jadex.commons

Class SNonAndroid


  • public class SNonAndroid
    extends java.lang.Object
    Helper class for methods used from non-android code.
    • Constructor Summary

      Constructors 
      Constructor Description
      SNonAndroid()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void clearAWT()
      Workaround for AWT/Swing memory leaks.
      static java.util.ResourceBundle findResourceBundle​(java.lang.String name, java.util.Locale currentLocale, java.lang.ClassLoader cl)
      Try to find a ResourceBundle by trying Classloaders from all calling Classes.
      static java.io.File getDefaultDirectory()
      Get the default directory.
      static java.lang.String getDisplayName​(java.io.File file)
      Get the display name (e.g.
      static java.io.File[] getFiles​(java.io.File file, boolean hiding)
      Get the files of a directory.
      static java.io.File getHomeDirectory()
      Get the home directory.
      static java.lang.String[] getMacAddresses()
      Get the mac address.
      static java.util.List<java.net.InetAddress> getNetworkIps()
      Get the network ips.
      static short getNetworkPrefixLength​(java.net.InetAddress iadr)
      Get the network prefix length for IPV4 address 24=C, 16=B, 8=A classes.
      static java.io.File getParentDirectory​(java.io.File file)
      Get the parent directory.
      static boolean hasGui()
      Test if there is a gui available.
      static boolean isFloppyDrive​(java.io.File file)
      Check if a file represents a floppy.
      static boolean isGuiThread()
      Test if a call is running on the swing thread.
      static void openFile​(java.lang.String path)
      Opens a File with the default application.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SNonAndroid

        public SNonAndroid()
    • Method Detail

      • getNetworkPrefixLength

        public static short getNetworkPrefixLength​(java.net.InetAddress iadr)
        Get the network prefix length for IPV4 address 24=C, 16=B, 8=A classes. Returns -1 in case of V6 address.
        Parameters:
        iadr - The address.
        Returns:
        The length of the prefix.
      • isFloppyDrive

        public static boolean isFloppyDrive​(java.io.File file)
        Check if a file represents a floppy.
      • getDisplayName

        public static java.lang.String getDisplayName​(java.io.File file)
        Get the display name (e.g. of a system drive).
      • findResourceBundle

        public static java.util.ResourceBundle findResourceBundle​(java.lang.String name,
                                                                  java.util.Locale currentLocale,
                                                                  java.lang.ClassLoader cl)
        Try to find a ResourceBundle by trying Classloaders from all calling Classes.
        Parameters:
        name - Name of the ResourceBundle to find
        currentLocale - Name of the locale
        cl - the default classloader
        Returns:
        The found ResourceBundle or null.
      • getNetworkIps

        public static java.util.List<java.net.InetAddress> getNetworkIps()
        Get the network ips.
      • openFile

        public static void openFile​(java.lang.String path)
                             throws java.io.IOException
        Opens a File with the default application.
        Parameters:
        path -
        Throws:
        java.io.IOException
      • isGuiThread

        public static boolean isGuiThread()
        Test if a call is running on the swing thread.
      • hasGui

        public static boolean hasGui()
        Test if there is a gui available.
      • getHomeDirectory

        public static java.io.File getHomeDirectory()
        Get the home directory.
      • getDefaultDirectory

        public static java.io.File getDefaultDirectory()
        Get the default directory.
      • getParentDirectory

        public static java.io.File getParentDirectory​(java.io.File file)
        Get the parent directory.
      • getFiles

        public static java.io.File[] getFiles​(java.io.File file,
                                              boolean hiding)
        Get the files of a directory.
      • getMacAddresses

        public static java.lang.String[] getMacAddresses()
        Get the mac address.
        Returns:
        The mac address.
      • clearAWT

        public static void clearAWT()
        Workaround for AWT/Swing memory leaks.