Top Description Fields Constructors Methods
org.apache.logging.log4j.util

public final Class StringBuilders

extends Object
Class Inheritance
Annotations
@InternalApi
Static Imports
java.lang.Character.toLowerCase

Consider this class private.

Field Summary

Modifier and TypeField and Description
private static final Class<?>
private static final Class<?>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static StringBuilder

Returns:

"value"
appendDqValue
(final StringBuilder
a string builder
sb
,
final Object
a value
value
)

Appends in the following format: double quoted value.

public static StringBuilder

Returns:

key="value"
appendKeyDqValue
(final StringBuilder
a string builder
sb
,
final Map.Entry<String, String>
a map entry
entry
)

Appends in the following format: key=double quoted value.

public static StringBuilder

Returns:

the specified StringBuilder
appendKeyDqValue
(final StringBuilder
a string builder
sb
,
final String
a key
key
,
final Object
a value
value
)

Appends in the following format: key=double quoted value.

public static boolean
appendSpecificTypes(final StringBuilder stringBuilder, final Object obj)

public static void
appendValue(final StringBuilder
the StringBuilder to append the value to
stringBuilder
,
final Object
the object whose text representation to append to the StringBuilder
obj
)

Appends a text representation of the specified object to the specified StringBuilder, if possible without allocating temporary objects.

public static boolean

Returns:

true if equal, false otherwise
equals
(final CharSequence
the left CharSequence
left
,
final int
start index in the left CharSequence
leftOffset
,
final int
length of the section in the left CharSequence
leftLength
,
final CharSequence
the right CharSequence to compare a section of
right
,
final int
start index in the right CharSequence
rightOffset
,
final int
length of the section in the right CharSequence
rightLength
)

Returns true if the specified section of the left CharSequence equals the specified section of the right CharSequence.

public static boolean

Returns:

true if equal ignoring case, false otherwise
equalsIgnoreCase
(final CharSequence
the left CharSequence
left
,
final int
start index in the left CharSequence
leftOffset
,
final int
length of the section in the left CharSequence
leftLength
,
final CharSequence
the right CharSequence to compare a section of
right
,
final int
start index in the right CharSequence
rightOffset
,
final int
length of the section in the right CharSequence
rightLength
)

Returns true if the specified section of the left CharSequence equals, ignoring case, the specified section of the right CharSequence.

private static int
escapeAndDecrement(final StringBuilder toAppendTo, int lastPos, final char c)

public static void
escapeJson(final StringBuilder toAppendTo, final int start)

public static void
escapeXml(final StringBuilder toAppendTo, final int start)

private static boolean
isDate(final Object obj)

private static boolean
isTime(final Object obj)

public static void
trimToMaxSize(final StringBuilder
the StringBuilder to check
stringBuilder
,
final int
the maximum number of characters the StringBuilder is allowed to have
maxSize
)

Ensures that the char[] array of the specified StringBuilder does not exceed the specified number of characters.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dateClassback to summary
private static final Class<?> dateClass
timeClassback to summary
private static final Class<?> timeClass

Constructor Detail

StringBuildersback to summary
private StringBuilders()

Method Detail

appendDqValueback to summary
public static StringBuilder appendDqValue(final StringBuilder sb, final Object value)

Appends in the following format: double quoted value.

Parameters
sb:StringBuilder

a string builder

value:Object

a value

Returns:StringBuilder

"value"

appendKeyDqValueback to summary
public static StringBuilder appendKeyDqValue(final StringBuilder sb, final Map.Entry<String, String> entry)

Appends in the following format: key=double quoted value.

Parameters
sb:StringBuilder

a string builder

entry:Map.Entry<String, String>

a map entry

Returns:StringBuilder

key="value"

appendKeyDqValueback to summary
public static StringBuilder appendKeyDqValue(final StringBuilder sb, final String key, final Object value)

Appends in the following format: key=double quoted value.

Parameters
sb:StringBuilder

a string builder

key:String

a key

value:Object

a value

Returns:StringBuilder

the specified StringBuilder

appendSpecificTypesback to summary
public static boolean appendSpecificTypes(final StringBuilder stringBuilder, final Object obj)
appendValueback to summary
public static void appendValue(final StringBuilder stringBuilder, final Object obj)

Appends a text representation of the specified object to the specified StringBuilder, if possible without allocating temporary objects.

Parameters
stringBuilder:StringBuilder

the StringBuilder to append the value to

obj:Object

the object whose text representation to append to the StringBuilder

equalsback to summary
public static boolean equals(final CharSequence left, final int leftOffset, final int leftLength, final CharSequence right, final int rightOffset, final int rightLength)

Returns true if the specified section of the left CharSequence equals the specified section of the right CharSequence.

Parameters
left:CharSequence

the left CharSequence

leftOffset:int

start index in the left CharSequence

leftLength:int

length of the section in the left CharSequence

right:CharSequence

the right CharSequence to compare a section of

rightOffset:int

start index in the right CharSequence

rightLength:int

length of the section in the right CharSequence

Returns:boolean

true if equal, false otherwise

equalsIgnoreCaseback to summary
public static boolean equalsIgnoreCase(final CharSequence left, final int leftOffset, final int leftLength, final CharSequence right, final int rightOffset, final int rightLength)

Returns true if the specified section of the left CharSequence equals, ignoring case, the specified section of the right CharSequence.

Parameters
left:CharSequence

the left CharSequence

leftOffset:int

start index in the left CharSequence

leftLength:int

length of the section in the left CharSequence

right:CharSequence

the right CharSequence to compare a section of

rightOffset:int

start index in the right CharSequence

rightLength:int

length of the section in the right CharSequence

Returns:boolean

true if equal ignoring case, false otherwise

escapeAndDecrementback to summary
private static int escapeAndDecrement(final StringBuilder toAppendTo, int lastPos, final char c)
escapeJsonback to summary
public static void escapeJson(final StringBuilder toAppendTo, final int start)
escapeXmlback to summary
public static void escapeXml(final StringBuilder toAppendTo, final int start)
isDateback to summary
private static boolean isDate(final Object obj)
isTimeback to summary
private static boolean isTime(final Object obj)
trimToMaxSizeback to summary
public static void trimToMaxSize(final StringBuilder stringBuilder, final int maxSize)

Ensures that the char[] array of the specified StringBuilder does not exceed the specified number of characters. This method is useful to ensure that excessively long char[] arrays are not kept in memory forever.

Parameters
stringBuilder:StringBuilder

the StringBuilder to check

maxSize:int

the maximum number of characters the StringBuilder is allowed to have

Since
2.9