jcifs
public class Config extends Object
System
properties the namespace
is global therefore property names should be unique. Before use,
the load
method should be called with the name of a
Properties
file (or null
indicating no
file) to initialize the Config
. The System
properties will then populate the Config
as well potentially
overwriting properties from the file. Thus properties provided on the
commandline with the -Dproperty.name=value
VM parameter
will override properties from the configuration file.
There are several ways to set jCIFS properties. See the overview page of the API documentation for details.
Field Summary | |
---|---|
static String | DEFAULT_OEM_ENCODING |
Method Summary | |
---|---|
static Object | get(String key)
Retrieve a property as an Object . |
static boolean | getBoolean(String key, boolean def)
Retrieve a boolean value. |
static InetAddress | getInetAddress(String key, InetAddress def)
Retrieve an InetAddress . |
static InetAddress[] | getInetAddressArray(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(String key, int def)
Retrieve an int . |
static int | getInt(String key)
Retrieve an int . |
static InetAddress | getLocalHost() |
static long | getLong(String key, long def)
Retrieve a long . |
static String | getProperty(String key, String def)
Retrieve a String . |
static String | getProperty(String key)
Retrieve a String . |
static void | list(PrintStream out)
List the properties in the Code . |
static void | load(InputStream in)
Load the Config with properties from the stream
in from a Properties file. |
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. |
static void | setProperties(Properties prp)
Set the default properties of the static Properties used by Config. |
static Object | setProperty(String key, String value)
Add a property. |
static void | store(OutputStream out, String header) |
Object
.def
is returned.InetAddress
. If the address is not
an IP address and cannot be resolved null
will
be returned.int
. If the key does not exist or
cannot be converted to an int
, the provided default
argument will be returned.int
. If the property is not found, -1
is returned.long
. If the key does not exist or
cannot be converted to a long
, the provided default
argument will be returned.String
. If the key cannot be found,
the provided def
default parameter will be returned.String
. If the property is not found, null
is returned.Code
.Config
with properties from the stream
in
from a Properties
file.Exception MalformedURLException: unknown protocol: smb at java.net.URL.(URL.java:480) at java.net.URL. (URL.java:376) at java.net.URL. (URL.java:330) at jcifs.smb.SmbFile. (SmbFile.java:355) ...