Class StringBuilderUtils


  • public class StringBuilderUtils
    extends java.lang.Object
    Internal string builder utilities for building HTTP header values.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private StringBuilderUtils()
      Prevents instantiation.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void appendEscapingQuotes​(java.lang.StringBuilder b, java.lang.String value)
      Append a new value to the string builder.
      static void appendQuoted​(java.lang.StringBuilder b, java.lang.String value)
      Append a new quoted value to the string builder.
      static void appendQuotedIfNonToken​(java.lang.StringBuilder b, java.lang.String value)
      Append a new value to the string builder.
      static void appendQuotedIfWhitespace​(java.lang.StringBuilder b, java.lang.String value)
      Append a new value to the string builder.
      • Methods inherited from class java.lang.Object

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

      • StringBuilderUtils

        private StringBuilderUtils()
        Prevents instantiation.
    • Method Detail

      • appendQuotedIfNonToken

        public static void appendQuotedIfNonToken​(java.lang.StringBuilder b,
                                                  java.lang.String value)
        Append a new value to the string builder. If the value contains non-token characters (e.g. control, white-space, quotes, separators, etc.), the appended value is quoted and all the quotes in the value are escaped.
        Parameters:
        b - string builder to be updated.
        value - value to be appended.
      • appendQuotedIfWhitespace

        public static void appendQuotedIfWhitespace​(java.lang.StringBuilder b,
                                                    java.lang.String value)
        Append a new value to the string builder. If the value contains white-space characters, the appended value is quoted and all the quotes in the value are escaped.
        Parameters:
        b - string builder to be updated.
        value - value to be appended.
      • appendQuoted

        public static void appendQuoted​(java.lang.StringBuilder b,
                                        java.lang.String value)
        Append a new quoted value to the string builder. The appended value is quoted and all the quotes in the value are escaped.
        Parameters:
        b - string builder to be updated.
        value - value to be appended.
      • appendEscapingQuotes

        public static void appendEscapingQuotes​(java.lang.StringBuilder b,
                                                java.lang.String value)
        Append a new value to the string builder. All the quotes in the value are escaped before appending.
        Parameters:
        b - string builder to be updated.
        value - value to be appended.