Package com.zeroc.Ice
Class Util
java.lang.Object
com.zeroc.Ice.Util
Utility methods for the Ice run time.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final EncodingVersion
static final EncodingVersion
static final ProtocolVersion
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Properties
Creates a new empty property set.static Properties
createProperties
(String[] args) Creates a property set initialized from an argument vector.static Properties
createProperties
(String[] args, Properties defaults) Creates a property set initialized from an argument vector.static Properties
createProperties
(String[] args, Properties defaults, List<String> remainingArgs) Creates a property set initialized from an argument vector and return the remaining arguments.static Properties
createProperties
(String[] args, List<String> remainingArgs) Creates a property set initialized from an argument vector and return the remaining arguments.static EncodingVersion
Returns the supported Ice encoding version.static ProtocolVersion
Returns the supported Ice protocol version.static String
Converts an encoding version to a string.static <T> InvocationFuture<T>
Returns the InvocationFuture equivalent of the given CompletableFuture.static Logger
Returns the process-wide logger.static String
identityToString
(Identity ident) Converts an object identity to a string.static String
identityToString
(Identity ident, ToStringMode toStringMode) Converts an object identity to a string.static Communicator
Creates a communicator using a default configuration.static Communicator
initialize
(InitializationData initData) Creates a communicator.static Communicator
initialize
(String[] args) Creates a communicator.static Communicator
initialize
(String[] args, InitializationData initData) Creates a communicator.static Communicator
initialize
(String[] args, InitializationData initData, List<String> remainingArgs) Creates a communicator.static Communicator
initialize
(String[] args, String configFile) Creates a communicator.static Communicator
initialize
(String[] args, String configFile, List<String> remainingArgs) Creates a communicator.static Communicator
initialize
(String[] args, List<String> remainingArgs) Creates a communicator.static int
Returns the Ice version as an integer in the formA.BB.CC
, whereA
indicates the major version,BB
indicates the minor version, andCC
indicates the patch level.static String
Converts a protocol version to a string.static int
proxyIdentityAndFacetCompare
(ObjectPrx lhs, ObjectPrx rhs) Compares the object identities and facets of two proxies.static int
proxyIdentityCompare
(ObjectPrx lhs, ObjectPrx rhs) Compares the object identities of two proxies.static void
setProcessLogger
(Logger logger) Changes the process-wide logger.static EncodingVersion
stringToEncodingVersion
(String version) Converts a string to an encoding version.static Identity
Converts a string to an object identity.static ProtocolVersion
stringToProtocolVersion
(String version) Converts a string to a protocol version.static String
Returns the Ice version in the formA.B.C
, whereA
indicates the major version,B
indicates the minor version, andC
indicates the patch level.static String
typeIdToClass
(String id) Translates a Slice type id to a Java class name.
-
Field Details
-
Protocol_1_0
-
Encoding_1_0
-
Encoding_1_1
-
-
Constructor Details
-
Util
public Util()
-
-
Method Details
-
createProperties
Creates a new empty property set.- Returns:
- A new empty property set.
-
createProperties
Creates a property set initialized from an argument vector.- Parameters:
args
- A command-line argument vector, possibly containing options to set properties. If the command-line options include a--Ice.Config
option, the corresponding configuration files are parsed. If the same property is set in a configuration file and in the argument vector, the argument vector takes precedence.- Returns:
- A new property set initialized with the property settings that were removed from the argument vector.
-
createProperties
Creates a property set initialized from an argument vector and return the remaining arguments.- Parameters:
args
- A command-line argument vector, possibly containing options to set properties. If the command-line options include a--Ice.Config
option, the corresponding configuration files are parsed. If the same property is set in a configuration file and in the argument vector, the argument vector takes precedence.remainingArgs
- If non null, the given list will contain on return the command-line arguments that were not used to set properties.- Returns:
- A new property set initialized with the property settings that were removed from the argument vector.
-
createProperties
Creates a property set initialized from an argument vector.- Parameters:
args
- A command-line argument vector, possibly containing options to set properties. If the command-line options include a--Ice.Config
option, the corresponding configuration files are parsed. If the same property is set in a configuration file and in the argument vector, the argument vector takes precedence.defaults
- Default values for the property set. Settings in configuration files andargs
override these defaults.- Returns:
- A new property set initialized with the property settings that were removed from the argument vector.
-
createProperties
public static Properties createProperties(String[] args, Properties defaults, List<String> remainingArgs) Creates a property set initialized from an argument vector and return the remaining arguments.- Parameters:
args
- A command-line argument vector, possibly containing options to set properties. If the command-line options include a--Ice.Config
option, the corresponding configuration files are parsed. If the same property is set in a configuration file and in the argument vector, the argument vector takes precedence.defaults
- Default values for the property set. Settings in configuration files andargs
override these defaults.remainingArgs
- If non null, the given list will contain on return the command-line arguments that were not used to set properties.- Returns:
- A new property set initialized with the property settings that were removed from the argument vector.
-
initialize
Creates a communicator using a default configuration.- Returns:
- A new communicator instance.
-
initialize
Creates a communicator.- Parameters:
args
- A command-line argument vector. Any Ice-related options in this vector are used to initialize the communicator.- Returns:
- The new communicator.
-
initialize
Creates a communicator.- Parameters:
args
- A command-line argument vector. Any Ice-related options in this vector are used to initialize the communicator.remainingArgs
- If non null, the given list will contain on return the command-line arguments that were not used to set properties.- Returns:
- The new communicator.
-
initialize
Creates a communicator.- Parameters:
initData
- Additional initialization data.- Returns:
- The new communicator.
-
initialize
Creates a communicator.- Parameters:
args
- A command-line argument vector. Any Ice-related options in this vector are used to initialize the communicator.initData
- Additional initialization data.- Returns:
- The new communicator.
-
initialize
Creates a communicator.- Parameters:
args
- A command-line argument vector. Any Ice-related options in this vector are used to initialize the communicator.configFile
- Path to a config file that sets the new communicator's default properties.- Returns:
- The new communicator.
-
initialize
public static Communicator initialize(String[] args, InitializationData initData, List<String> remainingArgs) Creates a communicator.- Parameters:
args
- A command-line argument vector. Any Ice-related options in this vector are used to initialize the communicator.initData
- Additional initialization data. Property settings inargs
override property settings ininitData
.remainingArgs
- If non null, the given list will contain on return the command-line arguments that were not used to set properties.- Returns:
- The new communicator.
- See Also:
-
initialize
Creates a communicator.- Parameters:
args
- A command-line argument vector. Any Ice-related options in this vector are used to initialize the communicator.configFile
- Path to a config file that sets the new communicator's default properties.remainingArgs
- If non null, the given list will contain on return the command-line arguments that were not used to set properties.- Returns:
- The new communicator.
-
stringToIdentity
Converts a string to an object identity.- Parameters:
s
- The string to convert.- Returns:
- The converted object identity.
-
identityToString
Converts an object identity to a string.- Parameters:
ident
- The object identity to convert.toStringMode
- Specifies if and how non-printable ASCII characters are escaped in the result.- Returns:
- The string representation of the object identity.
-
identityToString
Converts an object identity to a string.- Parameters:
ident
- The object identity to convert.- Returns:
- The string representation of the object identity using the default mode (Unicode)
-
proxyIdentityCompare
Compares the object identities of two proxies.- Parameters:
lhs
- A proxy.rhs
- A proxy.- Returns:
- -1 if the identity in
lhs
compares less than the identity inrhs
; 0 if the identities compare equal; 1, otherwise. - See Also:
-
proxyIdentityAndFacetCompare
Compares the object identities and facets of two proxies.- Parameters:
lhs
- A proxy.rhs
- A proxy.- Returns:
- -1 if the identity and facet in
lhs
compare less than the identity and facet inrhs
; 0 if the identities and facets compare equal; 1, otherwise. - See Also:
-
getProcessLogger
Returns the process-wide logger.- Returns:
- The process-wide logger.
-
setProcessLogger
Changes the process-wide logger.- Parameters:
logger
- The new process-wide logger.
-
stringVersion
Returns the Ice version in the formA.B.C
, whereA
indicates the major version,B
indicates the minor version, andC
indicates the patch level.- Returns:
- The Ice version.
-
intVersion
public static int intVersion()Returns the Ice version as an integer in the formA.BB.CC
, whereA
indicates the major version,BB
indicates the minor version, andCC
indicates the patch level. For example, for Ice 3.3.1, the returned value is 30301.- Returns:
- The Ice version.
-
stringToProtocolVersion
Converts a string to a protocol version.- Parameters:
version
- The string to convert.- Returns:
- The converted protocol version.
-
stringToEncodingVersion
Converts a string to an encoding version.- Parameters:
version
- The string to convert.- Returns:
- The converted encoding version.
-
protocolVersionToString
Converts a protocol version to a string.- Parameters:
v
- The protocol version to convert.- Returns:
- The converted string.
-
encodingVersionToString
Converts an encoding version to a string.- Parameters:
v
- The encoding version to convert.- Returns:
- The converted string.
-
currentProtocol
Returns the supported Ice protocol version.- Returns:
- The Ice protocol version.
-
currentEncoding
Returns the supported Ice encoding version.- Returns:
- The Ice encoding version.
-
getInvocationFuture
Returns the InvocationFuture equivalent of the given CompletableFuture.- Type Parameters:
T
- The result type.- Parameters:
f
- The CompletableFuture returned by an asynchronous Ice proxy invocation.- Returns:
- The InvocationFuture object.
-
typeIdToClass
Translates a Slice type id to a Java class name.- Parameters:
id
- The Slice type id, such as::Module::Type
.- Returns:
- The equivalent Java class name, or null if the type id is malformed.
-