Class StringBuilderUtils


  • public class StringBuilderUtils
    extends Object
    Internal string builder utilities for building HTTP header values.
    Author:
    Marc Hadley, Marek Potociar, Martin Matula
    • Method Detail

      • appendQuotedIfNonToken

        public static void appendQuotedIfNonToken​(StringBuilder b,
                                                  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​(StringBuilder b,
                                                    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​(StringBuilder b,
                                        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​(StringBuilder b,
                                                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.