Class StringUtils


  • public class StringUtils
    extends java.lang.Object
    Set of String utilities used in the proton code.
    • Constructor Summary

      Constructors 
      Constructor Description
      StringUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String toQuotedString​(ProtonBuffer buffer)
      Converts the ProtonBuffer to a quoted string using a default max length before truncation value and appends a truncation indication if the string required truncation.
      static java.lang.String toQuotedString​(ProtonBuffer buffer, boolean appendIfTruncated)
      Converts the ProtonBuffer to a quoted string using a default max length before truncation value.
      static java.lang.String toQuotedString​(ProtonBuffer buffer, int stringLength, boolean appendIfTruncated)
      Converts the ProtonBuffer to a quoted string.
      static java.lang.String toQuotedString​(Binary buffer)
      Converts the Binary to a quoted string using a default max length before truncation value and appends a truncation indication if the string required truncation.
      static java.lang.String toQuotedString​(Binary buffer, boolean appendIfTruncated)
      Converts the Binary to a quoted string using a default max length before truncation value.
      static java.lang.String toQuotedString​(Binary buffer, int stringLength, boolean appendIfTruncated)
      Converts the Binary to a quoted string.
      static java.lang.String[] toStringArray​(Symbol[] symbolArray)
      Converts the given Symbol[] into a String[] array.
      static java.util.Map<java.lang.String,​java.lang.Object> toStringKeyedMap​(java.util.Map<Symbol,​java.lang.Object> symbolMap)
      Converts the given Symbol keyed Map into a matching String keyed Map.
      static java.util.Set<java.lang.String> toStringSet​(Symbol[] symbols)
      Converts the given Symbol array into a matching String Set.
      static Symbol[] toSymbolArray​(java.lang.String[] stringArray)
      Converts the given String[] into a Symbol[] array.
      static Symbol[] toSymbolArray​(java.util.Collection<java.lang.String> stringsSet)
      Converts the given String Collection into a Symbol array.
      static java.util.Map<Symbol,​java.lang.Object> toSymbolKeyedMap​(java.util.Map<java.lang.String,​java.lang.Object> stringsMap)
      Converts the given String keyed Map into a matching Symbol keyed Map.
      static java.util.Set<Symbol> toSymbolSet​(java.util.Collection<java.lang.String> stringsSet)
      Converts the given String Collection into a matching Symbol Set.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StringUtils

        public StringUtils()
    • Method Detail

      • toSymbolArray

        public static Symbol[] toSymbolArray​(java.lang.String[] stringArray)
        Converts the given String[] into a Symbol[] array.
        Parameters:
        stringArray - The given String[] to convert.
        Returns:
        a new Symbol array that contains Symbol versions of the input Strings.
      • toStringArray

        public static java.lang.String[] toStringArray​(Symbol[] symbolArray)
        Converts the given Symbol[] into a String[] array.
        Parameters:
        symbolArray - The given Symbol[] to convert.
        Returns:
        a new String array that contains String versions of the input Symbol.
      • toSymbolKeyedMap

        public static java.util.Map<Symbol,​java.lang.Object> toSymbolKeyedMap​(java.util.Map<java.lang.String,​java.lang.Object> stringsMap)
        Converts the given String keyed Map into a matching Symbol keyed Map.
        Parameters:
        stringsMap - The given String keyed Map to convert.
        Returns:
        a new Symbol keyed Map that contains Symbol versions of the input String keys.
      • toStringKeyedMap

        public static java.util.Map<java.lang.String,​java.lang.Object> toStringKeyedMap​(java.util.Map<Symbol,​java.lang.Object> symbolMap)
        Converts the given Symbol keyed Map into a matching String keyed Map.
        Parameters:
        symbolMap - The given String keyed Map to convert.
        Returns:
        a new String keyed Map that contains String versions of the input Symbol keys.
      • toSymbolArray

        public static Symbol[] toSymbolArray​(java.util.Collection<java.lang.String> stringsSet)
        Converts the given String Collection into a Symbol array.
        Parameters:
        stringsSet - The given String Collection to convert.
        Returns:
        a new Symbol array that contains String versions of the input Symbols.
      • toSymbolSet

        public static java.util.Set<Symbol> toSymbolSet​(java.util.Collection<java.lang.String> stringsSet)
        Converts the given String Collection into a matching Symbol Set.
        Parameters:
        stringsSet - The given String Collection to convert.
        Returns:
        a new Symbol Set that contains String versions of the input Symbols.
      • toStringSet

        public static java.util.Set<java.lang.String> toStringSet​(Symbol[] symbols)
        Converts the given Symbol array into a matching String Set.
        Parameters:
        symbols - The given Symbol array to convert.
        Returns:
        a new String Set that contains String versions of the input Symbols.
      • toQuotedString

        public static java.lang.String toQuotedString​(Binary buffer)
        Converts the Binary to a quoted string using a default max length before truncation value and appends a truncation indication if the string required truncation.
        Parameters:
        buffer - the Binary to convert into String format.
        Returns:
        the converted string
      • toQuotedString

        public static java.lang.String toQuotedString​(Binary buffer,
                                                      boolean appendIfTruncated)
        Converts the Binary to a quoted string using a default max length before truncation value.
        Parameters:
        buffer - the Binary to convert into String format.
        appendIfTruncated - appends "...(truncated)" if not all of the payload is present in the string
        Returns:
        the converted string
      • toQuotedString

        public static java.lang.String toQuotedString​(Binary buffer,
                                                      int stringLength,
                                                      boolean appendIfTruncated)
        Converts the Binary to a quoted string.
        Parameters:
        buffer - the Binary to convert into String format.
        stringLength - the maximum length of stringified content (excluding the quotes, and truncated indicator)
        appendIfTruncated - appends "...(truncated)" if not all of the payload is present in the string
        Returns:
        the converted string
      • toQuotedString

        public static java.lang.String toQuotedString​(ProtonBuffer buffer)
        Converts the ProtonBuffer to a quoted string using a default max length before truncation value and appends a truncation indication if the string required truncation.
        Parameters:
        buffer - the ProtonBuffer to convert into String format.
        Returns:
        the converted string
      • toQuotedString

        public static java.lang.String toQuotedString​(ProtonBuffer buffer,
                                                      boolean appendIfTruncated)
        Converts the ProtonBuffer to a quoted string using a default max length before truncation value.
        Parameters:
        buffer - the ProtonBuffer to convert into String format.
        appendIfTruncated - appends "...(truncated)" if not all of the payload is present in the string
        Returns:
        the converted string
      • toQuotedString

        public static java.lang.String toQuotedString​(ProtonBuffer buffer,
                                                      int stringLength,
                                                      boolean appendIfTruncated)
        Converts the ProtonBuffer to a quoted string.
        Parameters:
        buffer - the ProtonBuffer to convert into String format.
        stringLength - the maximum length of stringified content (excluding the quotes, and truncated indicator)
        appendIfTruncated - appends "...(truncated)" if not all of the payload is present in the string
        Returns:
        the converted string