Package com.zeroc.Ice

Class Util

java.lang.Object
com.zeroc.Ice.Util

public final class Util extends Object
Utility methods for the Ice runtime.
  • Field Details

    • Protocol_1_0

      public static final ProtocolVersion Protocol_1_0
      The protocol version 1.0.
    • Encoding_1_0

      public static final EncodingVersion Encoding_1_0
      The encoding version 1.0.
    • Encoding_1_1

      public static final EncodingVersion Encoding_1_1
      The encoding version 1.1.
  • Method Details

    • createProperties

      @Deprecated public static Properties createProperties()
      Deprecated.
      Use Properties() instead.
      Creates a new empty property set.
      Returns:
      A new empty property set.
    • createProperties

      @Deprecated public static Properties createProperties(String[] args)
      Deprecated.
      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

      @Deprecated public static Properties createProperties(String[] args, List<String> remainingArgs)
      Deprecated.
      Creates a property set initialized from an argument vector and returns 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

      @Deprecated public static Properties createProperties(String[] args, Properties defaults)
      Deprecated.
      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 and args override these defaults.
      Returns:
      A new property set initialized with the property settings that were removed from the argument vector.
    • createProperties

      @Deprecated public static Properties createProperties(String[] args, Properties defaults, List<String> remainingArgs)
      Creates a property set initialized from an argument vector and returns 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 and args 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

      public static Communicator initialize(InitializationData initData)
      Creates a new communicator.
      Parameters:
      initData - Options for the new communicator.
      Returns:
      The new communicator.
      See Also:
    • initialize

      public static Communicator initialize()
      Creates a new communicator with the default options.
      Returns:
      The new communicator.
    • initialize

      public static Communicator initialize(String[] args, List<String> remainingArgs)
      Creates a new communicator, using Ice properties parsed from command-line arguments.
      Parameters:
      args - A command-line argument vector. This method parses arguments starting with `--` and one of the reserved prefixes (Ice, IceSSL, etc.) as properties for the new communicator. If there is an argument starting with `--Ice.Config`, this method loads the specified configuration file. When the same property is set in a configuration file and through a command-line argument, the command-line setting 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:
      The new communicator.
    • initialize

      public static Communicator initialize(String[] args)
      Creates a new communicator, using Ice properties parsed from command-line arguments.
      Parameters:
      args - A command-line argument vector. This method parses arguments starting with `--` and one of the reserved prefixes (Ice, IceSSL, etc.) as properties for the new communicator. If there is an argument starting with `--Ice.Config`, this method loads the specified configuration file. When the same property is set in a configuration file and through a command-line argument, the command-line setting takes precedence.
      Returns:
      The new communicator.
    • stringToIdentity

      public static Identity stringToIdentity(String s)
      Converts a stringified identity into an Identity.
      Parameters:
      s - The string to convert.
      Returns:
      The converted object identity.
    • identityToString

      public static String identityToString(Identity ident, ToStringMode toStringMode)
      Converts an Identity into a string using the specified mode.
      Parameters:
      ident - The object identity to convert.
      toStringMode - Specifies how to handle non-ASCII characters and non-printable ASCII characters.
      Returns:
      the stringified identifier
    • identityToString

      public static String identityToString(Identity ident)
      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

      public static int proxyIdentityCompare(ObjectPrx lhs, ObjectPrx rhs)
      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 in rhs; 0 if the identities compare equal; 1, otherwise.
      See Also:
    • proxyIdentityAndFacetCompare

      public static int proxyIdentityAndFacetCompare(ObjectPrx lhs, ObjectPrx rhs)
      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 in rhs; 0 if the identities and facets compare equal; 1, otherwise.
      See Also:
    • getProcessLogger

      public static Logger getProcessLogger()
      Gets the per-process logger. This logger is used by all communicators that do not have their own specific logger configured at the time the communicator is created.
      Returns:
      The current per-process logger instance.
    • setProcessLogger

      public static void setProcessLogger(Logger logger)
      Sets the per-process logger. This logger is used by all communicators that do not have their own specific logger configured at the time the communicator is created.
      Parameters:
      logger - The new per-process logger instance.
    • stringVersion

      public static String stringVersion()
      Returns the Ice version in the form A.B.C, where A indicates the major version, B indicates the minor version, and C indicates the patch level.
      Returns:
      The Ice version.
    • intVersion

      public static int intVersion()
      Returns the Ice version as an integer in the form AABBCC, where AA indicates the major version, BB indicates the minor version, and CC indicates the patch level. For example, for Ice 3.8.1, the returned value is 30801.
      Returns:
      The Ice version.
    • stringToProtocolVersion

      public static ProtocolVersion stringToProtocolVersion(String version)
      Converts a string to a protocol version.
      Parameters:
      version - The string to convert.
      Returns:
      The converted protocol version.
    • stringToEncodingVersion

      public static EncodingVersion stringToEncodingVersion(String version)
      Converts a string to an encoding version.
      Parameters:
      version - The string to convert.
      Returns:
      The converted encoding version.
    • protocolVersionToString

      public static String protocolVersionToString(ProtocolVersion v)
      Converts a protocol version to a string.
      Parameters:
      v - The protocol version to convert.
      Returns:
      The converted string.
    • encodingVersionToString

      public static String encodingVersionToString(EncodingVersion v)
      Converts an encoding version to a string.
      Parameters:
      v - The encoding version to convert.
      Returns:
      The converted string.
    • currentProtocol

      public static ProtocolVersion currentProtocol()
      Returns the supported Ice protocol version.
      Returns:
      The Ice protocol version.
    • currentEncoding

      public static EncodingVersion currentEncoding()
      Returns the supported Slice encoding version.
      Returns:
      The Slice encoding version.
    • getInvocationFuture

      public static <T> InvocationFuture<T> getInvocationFuture(CompletableFuture<T> f)
      Downcasts a CompletableFuture<T> to an InvocationFuture<T> object.
      Type Parameters:
      T - The result type.
      Parameters:
      f - The CompletableFuture returned by an asynchronous invocation.
      Returns:
      f casted to an InvocationFuture<T>.
      Throws:
      ClassCastException - if f is not an InvocationFuture<T>.
    • typeIdToClass

      public static String typeIdToClass(String id)
      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.