public class Config extends Object
jcifs.context.CIFSContext
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 intialized using system properties.Constructor and Description |
---|
Config() |
Modifier and Type | Method and Description |
---|---|
static boolean |
getBoolean(Properties props,
String key,
boolean def)
Retrieve a boolean value.
|
static InetAddress |
getInetAddress(Properties props,
String key,
InetAddress def)
Retrieve an
InetAddress . |
static InetAddress[] |
getInetAddressArray(Properties props,
String key,
String delim,
InetAddress[] def)
Retrieve an array of InetAddress created from a property
value containting a delim separated list of hostnames and/or
ipaddresses.
|
static int |
getInt(Properties props,
String key)
Retrieve an
int . |
static int |
getInt(Properties props,
String key,
int def)
Retrieve an
int . |
static InetAddress |
getLocalHost(Properties props) |
static long |
getLong(Properties props,
String key,
long def)
Retrieve a
long . |
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.
|
public static void registerSmbURLHandler()
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) ...
public static int getInt(Properties props, String key, int def)
int
. If the key does not exist or
cannot be converted to an int
, the provided default
argument will be returned.public static int getInt(Properties props, String key)
int
. If the property is not found, -1
is returned.public static long getLong(Properties props, String key, long def)
long
. If the key does not exist or
cannot be converted to a long
, the provided default
argument will be returned.public static InetAddress getInetAddress(Properties props, String key, InetAddress def)
InetAddress
. If the address is not
an IP address and cannot be resolved null
will
be returned.public static InetAddress getLocalHost(Properties props)
public static boolean getBoolean(Properties props, String key, boolean def)
def
is returned.public static InetAddress[] getInetAddressArray(Properties props, String key, String delim, InetAddress[] def)
Copyright © 2016. All rights reserved.