Package jcifs

Class Config


  • public class Config
    extends Object
    This class now contains only utilities for config parsing. We strongly suggest that you create an explicit CIFSContextWrapper with your desired config. It's base implementation BaseContext should be sufficient for most needs. If you want to retain the classic singleton behavior you can use SingletonContext.getInstance() witch is initialized using system properties.
    • Constructor Detail

      • Config

        public Config()
    • Method Detail

      • registerSmbURLHandler

        public static void registerSmbURLHandler()
        This static method registers the SMB URL protocol handler which is required to use SMB URLs with the java.net.URL class. If this method is not called before attempting to create an SMB URL with the URL class the following exception will occur:
         Exception MalformedURLException: unknown protocol: smb
             at java.net.URL.<init>(URL.java:480)
             at java.net.URL.<init>(URL.java:376)
             at java.net.URL.<init>(URL.java:330)
             at jcifs.smb.SmbFile.<init>(SmbFile.java:355)
             ...
         
      • getInt

        public static int getInt​(Properties props,
                                 String key,
                                 int def)
        Retrieve an int. If the key does not exist or cannot be converted to an int, the provided default argument will be returned.
      • getInt

        public static int getInt​(Properties props,
                                 String key)
        Retrieve an int. If the property is not found, -1 is returned.
      • getLong

        public static long getLong​(Properties props,
                                   String key,
                                   long def)
        Retrieve a long. If the key does not exist or cannot be converted to a long, the provided default argument will be returned.
      • getInetAddress

        public static InetAddress getInetAddress​(Properties props,
                                                 String key,
                                                 InetAddress def)
        Retrieve an InetAddress. If the address is not an IP address and cannot be resolved null will be returned.
      • getBoolean

        public static boolean getBoolean​(Properties props,
                                         String key,
                                         boolean def)
        Retrieve a boolean value. If the property is not found, the value of def is returned.
      • getInetAddressArray

        public static InetAddress[] getInetAddressArray​(Properties props,
                                                        String key,
                                                        String delim,
                                                        InetAddress[] def)
        Retrieve an array of InetAddress created from a property value containing a delim separated list of host names and/or ip addresses.