C# Class SharpCifs.Config

This class uses a static Sharpen.Properties to act as a cental repository for all jCIFS configuration properties. It cannot be instantiated. Similar to 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.
Show file Open project: brandonprry/Potato

Public Properties

Property Type Description
DefaultOemEncoding string
signalHandler System.Threading.AutoResetEvent
signalHandlerClient System.Threading.AutoResetEvent

Public Methods

Method Description
Get ( string key ) : object

Retrieve a property as an Object.

Retrieve a property as an Object.

GetBoolean ( string key, bool def ) : bool

Retrieve a boolean value.

Retrieve a boolean value. If the property is not found, the value of def is returned.

GetInetAddress ( string key, IPAddress def ) : IPAddress

Retrieve an InetAddress.

Retrieve an InetAddress. If the address is not an IP address and cannot be resolved null will be returned.

GetInetAddressArray ( string key, string delim, IPAddress def ) : System.Net.IPAddress[]

Retrieve an array of InetAddress created from a property value containting a delim separated list of hostnames and/or ipaddresses.

Retrieve an array of InetAddress created from a property value containting a delim separated list of hostnames and/or ipaddresses.

GetInt ( string key ) : int

Retrieve an int.

Retrieve an int. If the property is not found, -1 is returned.

GetInt ( string key, int def ) : int

Retrieve an int.

Retrieve an int. If the key does not exist or cannot be converted to an int, the provided default argument will be returned.

GetLocalHost ( ) : IPAddress
GetLong ( string key, long def ) : long

Retrieve a long.

Retrieve a long. If the key does not exist or cannot be converted to a long, the provided default argument will be returned.

GetProperty ( string key ) : string

Retrieve a String.

Retrieve a String. If the property is not found, null is returned.

GetProperty ( string key, string def ) : string

Retrieve a String.

Retrieve a String. If the key cannot be found, the provided def default parameter will be returned.

Load ( InputStream input ) : void

Load the Config with properties from the stream in from a Properties file.

Load the Config with properties from the stream in from a Properties file.

RegisterSmbURLHandler ( ) : void

This static method registers the SMB URL protocol handler which is required to use SMB URLs with the java.net.URL class.

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.(URL.java:480) at java.net.URL.(URL.java:376) at java.net.URL.(URL.java:330) at jcifs.smb.SmbFile.(SmbFile.java:355) ... 
SetProperties ( Properties prp ) : void

Set the default properties of the static Properties used by Config.

Set the default properties of the static Properties used by Config. This permits a different Properties object/file to be used as the source of properties for use by the jCIFS library. The Properties must be set before jCIFS classes are accessed as most jCIFS classes load properties statically once. Using this method will also override properties loaded using the -Djcifs.properties= commandline parameter.

SetProperty ( string key, string value ) : void

Add a property.

Add a property.

Store ( SharpCifs.Util.Sharpen.OutputStream output, string header ) : void
getNtlmContextFactory ( ) : INtlmContextFactory
setNtlmContextFactory ( INtlmContextFactory factory ) : void

Private Methods

Method Description
Config ( ) : System

Method Details

Get() public static method

Retrieve a property as an Object.
Retrieve a property as an Object.
public static Get ( string key ) : object
key string
return object

GetBoolean() public static method

Retrieve a boolean value.
Retrieve a boolean value. If the property is not found, the value of def is returned.
public static GetBoolean ( string key, bool def ) : bool
key string
def bool
return bool

GetInetAddress() public static method

Retrieve an InetAddress.
Retrieve an InetAddress. If the address is not an IP address and cannot be resolved null will be returned.
public static GetInetAddress ( string key, IPAddress def ) : IPAddress
key string
def System.Net.IPAddress
return System.Net.IPAddress

GetInetAddressArray() public static method

Retrieve an array of InetAddress created from a property value containting a delim separated list of hostnames and/or ipaddresses.
Retrieve an array of InetAddress created from a property value containting a delim separated list of hostnames and/or ipaddresses.
public static GetInetAddressArray ( string key, string delim, IPAddress def ) : System.Net.IPAddress[]
key string
delim string
def System.Net.IPAddress
return System.Net.IPAddress[]

GetInt() public static method

Retrieve an int.
Retrieve an int. If the property is not found, -1 is returned.
public static GetInt ( string key ) : int
key string
return int

GetInt() public static method

Retrieve an int.
Retrieve an int. If the key does not exist or cannot be converted to an int, the provided default argument will be returned.
public static GetInt ( string key, int def ) : int
key string
def int
return int

GetLocalHost() public static method

public static GetLocalHost ( ) : IPAddress
return System.Net.IPAddress

GetLong() public static method

Retrieve a long.
Retrieve a long. If the key does not exist or cannot be converted to a long, the provided default argument will be returned.
public static GetLong ( string key, long def ) : long
key string
def long
return long

GetProperty() public static method

Retrieve a String.
Retrieve a String. If the property is not found, null is returned.
public static GetProperty ( string key ) : string
key string
return string

GetProperty() public static method

Retrieve a String.
Retrieve a String. If the key cannot be found, the provided def default parameter will be returned.
public static GetProperty ( string key, string def ) : string
key string
def string
return string

Load() public static method

Load the Config with properties from the stream in from a Properties file.
Load the Config with properties from the stream in from a Properties file.
public static Load ( InputStream input ) : void
input SharpCifs.Util.Sharpen.InputStream
return void

RegisterSmbURLHandler() public static method

This static method registers the SMB URL protocol handler which is required to use SMB URLs with the java.net.URL class.
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.(URL.java:480) at java.net.URL.(URL.java:376) at java.net.URL.(URL.java:330) at jcifs.smb.SmbFile.(SmbFile.java:355) ... 
public static RegisterSmbURLHandler ( ) : void
return void

SetProperties() public static method

Set the default properties of the static Properties used by Config.
Set the default properties of the static Properties used by Config. This permits a different Properties object/file to be used as the source of properties for use by the jCIFS library. The Properties must be set before jCIFS classes are accessed as most jCIFS classes load properties statically once. Using this method will also override properties loaded using the -Djcifs.properties= commandline parameter.
public static SetProperties ( Properties prp ) : void
prp SharpCifs.Util.Sharpen.Properties
return void

SetProperty() public static method

Add a property.
Add a property.
public static SetProperty ( string key, string value ) : void
key string
value string
return void

Store() public static method

public static Store ( SharpCifs.Util.Sharpen.OutputStream output, string header ) : void
output SharpCifs.Util.Sharpen.OutputStream
header string
return void

getNtlmContextFactory() public static method

public static getNtlmContextFactory ( ) : INtlmContextFactory
return INtlmContextFactory

setNtlmContextFactory() public static method

public static setNtlmContextFactory ( INtlmContextFactory factory ) : void
factory INtlmContextFactory
return void

Property Details

DefaultOemEncoding public static property

public static string DefaultOemEncoding
return string

signalHandler public static property

public static AutoResetEvent,System.Threading signalHandler
return System.Threading.AutoResetEvent

signalHandlerClient public static property

public static AutoResetEvent,System.Threading signalHandlerClient
return System.Threading.AutoResetEvent