Package jcifs
Class Config
- java.lang.Object
-
- jcifs.Config
-
public class Config extends Object
This class now contains only utilities for config parsing. We strongly suggest that you create an explicitCIFSContextWrapper
with your desired config. It's base implementationBaseContext
should be sufficient for most needs. If you want to retain the classic singleton behavior you can useSingletonContext.getInstance()
witch is initialized using system properties.
-
-
Constructor Summary
Constructors Constructor Description Config()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
getBoolean(Properties props, String key, boolean def)
Retrieve a boolean value.static InetAddress
getInetAddress(Properties props, String key, InetAddress def)
Retrieve anInetAddress
.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.static int
getInt(Properties props, String key)
Retrieve anint
.static int
getInt(Properties props, String key, int def)
Retrieve anint
.static InetAddress
getLocalHost(Properties props)
static long
getLong(Properties props, String key, long def)
Retrieve along
.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.
-
-
-
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 anint
. If the key does not exist or cannot be converted to anint
, the provided default argument will be returned.
-
getInt
public static int getInt(Properties props, String key)
Retrieve anint
. If the property is not found,-1
is returned.
-
getLong
public static long getLong(Properties props, String key, long def)
Retrieve along
. If the key does not exist or cannot be converted to along
, the provided default argument will be returned.
-
getInetAddress
public static InetAddress getInetAddress(Properties props, String key, InetAddress def)
Retrieve anInetAddress
. If the address is not an IP address and cannot be resolvednull
will be returned.
-
getLocalHost
public static InetAddress getLocalHost(Properties props)
-
getBoolean
public static boolean getBoolean(Properties props, String key, boolean def)
Retrieve a boolean value. If the property is not found, the value ofdef
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.
-
-