Class UnicodeString

    • Field Detail

      • string

        @NotNull
        public final String string
        Underlying wrapped string. Not null.
    • Constructor Detail

      • UnicodeString

        public UnicodeString​(@NotNull
                             String string)
        Wraps a string to mark it as Unicode.
        Parameters:
        string - the string to wrap.
    • Method Detail

      • unicode

        @NotNull
        public static UnicodeString unicode​(@NotNull
                                            String string)
        Wraps a string to mark it as Unicode.
        Parameters:
        string - the string to wrap.
        Returns:
        wrapped string.
      • unicode

        @NotNull
        public static UnicodeString unicode​(@NotNull
                                            String string,
                                            int limitLength)
        Wraps a string to mark it as Unicode.
        Parameters:
        string - the string to wrap.
        limitLength - the maximum possible length of the string; the string tail can be truncated.
        Returns:
        wrapped string.
      • unicodeOrNull

        @Nullable
        @Contract("null -> null; !null -> !null")
        public static UnicodeString unicodeOrNull​(@Nullable
                                                  String string)
        Wraps a string to mark it as Unicode.
        Parameters:
        string - the string to wrap.
        Returns:
        wrapped string.
      • unicodeOrNull

        @Nullable
        @Contract("null,_ -> null; !null,_ -> !null")
        public static UnicodeString unicodeOrNull​(@Nullable
                                                  String string,
                                                  int limitLength)
        Wraps a string to mark it as Unicode.
        Parameters:
        string - the string to wrap.
        limitLength - the maximum possible length of the string; the string tail can be truncated.
        Returns:
        wrapped string.
      • charAt

        public char charAt​(int index)
        Specified by:
        charAt in interface CharSequence
      • equals

        public final boolean equals​(Object that)
        Overrides:
        equals in class Object
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class Object
      • substring

        @NotNull
        public final UnicodeString substring​(int beginIndex)
      • substring

        @NotNull
        public final UnicodeString substring​(int beginIndex,
                                             int endIndex)
      • getBytes

        @NotNull
        public final byte[] getBytes()
      • getBytes

        @NotNull
        public static byte[] getBytes​(@NotNull
                                      String string)
      • compare

        public static int compare​(@Nullable
                                  UnicodeString str1,
                                  @Nullable
                                  UnicodeString str2)
        Safely compares two unicode strings. Nulls are allowed.
        Parameters:
        str1 - first string.
        str2 - second string.
        Returns:
        result