Enum Utf8Utils

  • All Implemented Interfaces:
    Serializable, Comparable<Utf8Utils>

    public enum Utf8Utils
    extends Enum<Utf8Utils>
    It seems really unnecessary to spin up a different thread for the conversion; unfortunately, without this, we might see this method throw ClosedByInterruptException.

    If the conversion gets interrupted, and that is undesirable; by running it in another thread, the conversion doesn’t get interrupted.

    If that is not important to you, the most efficient way would be to run the conversion in the same thread; you can do that by running Utf8Utils.setExecutor(Utf8Utils.buildDirectExecutor());

    • Method Detail

      • values

        public static Utf8Utils[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (Utf8Utils c : Utf8Utils.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Utf8Utils valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • buildDefaultExecutorService

        public static ThreadPoolExecutor buildDefaultExecutorService()
        Build the default executor service for Utf8 conversion.
        Returns:
        thread pool executor
      • buildDirectExecutor

        public static Executor buildDirectExecutor()
        Build an executor that runs the task in the same thread.
        Returns:
        executor that runs the task in the same thread.
      • setExecutor

        public static void setExecutor​(Executor executor)
        Set a different executor for the Utf conversion.
        Parameters:
        executor -