public final class CharSequences
extends Object
CharSequence implementations.| Modifier and Type | Method and Description |
|---|---|
static boolean |
contentEquals(CharSequence a,
CharSequence b)
Returns
true if the content of both CharSequence's are equals. |
static boolean |
contentEqualsIgnoreCase(CharSequence a,
CharSequence b)
Perform a case-insensitive comparison of two
CharSequences. |
static CharSequence |
emptyAsciiString()
Get a reference to an unmodifiable empty
CharSequence with the same properties as
newAsciiString(Buffer). |
static int |
indexOf(CharSequence sequence,
char c,
int fromIndex)
Find the index of
c within sequence starting at index fromIndex. |
static CharSequence |
newAsciiString(Buffer input)
Create a new
CharSequence from the specified input, supporting only 8-bit ASCII characters, and
with a case-insensitive hashCode. |
static CharSequence |
newAsciiString(String input)
Create a new
CharSequence from the specified input, supporting only 8-bit ASCII characters, and
with a case-insensitive hashCode. |
static boolean |
regionMatches(CharSequence cs,
boolean ignoreCase,
int csStart,
CharSequence string,
int start,
int length)
This methods make regionMatches operation correctly for any chars in strings.
|
static Buffer |
unwrapBuffer(CharSequence cs)
Attempt to unwrap a
CharSequence and obtain the underlying Buffer if possible. |
public static CharSequence newAsciiString(String input)
CharSequence from the specified input, supporting only 8-bit ASCII characters, and
with a case-insensitive hashCode.
Supporting only 8-bit ASCII and providing a case-insensitive hashCode allows for optimizations when the
CharSequence returned is used as HttpHeaders names or values.
input - a string containing only 8-bit ASCII characters.CharSequencepublic static CharSequence newAsciiString(Buffer input)
CharSequence from the specified input, supporting only 8-bit ASCII characters, and
with a case-insensitive hashCode.
Supporting only 8-bit ASCII and providing a case-insensitive hashCode allows for optimizations when the
CharSequence returned is used as HttpHeaders names or values.
input - a Buffer containingCharSequence.public static CharSequence emptyAsciiString()
CharSequence with the same properties as
newAsciiString(Buffer).CharSequence with the same properties as
newAsciiString(Buffer).@Nullable public static Buffer unwrapBuffer(CharSequence cs)
CharSequence and obtain the underlying Buffer if possible.cs - the CharSequence to unwrap.Buffer or null.public static boolean contentEqualsIgnoreCase(@Nullable
CharSequence a,
@Nullable
CharSequence b)
CharSequences.
NOTE: This only supports 8-bit ASCII.
a - first CharSequence to compare.b - second CharSequence to compare.true if both CharSequence's are equals when ignoring the case.public static boolean contentEquals(CharSequence a,
CharSequence b)
true if the content of both CharSequence's are equals. This only supports 8-bit ASCII.a - left hand side of comparison.b - right hand side of comparison.true if a's content equals b.public static int indexOf(CharSequence sequence,
char c,
int fromIndex)
c within sequence starting at index fromIndex.sequence - The CharSequence to search in.c - The character to find.fromIndex - The index to start searching (inclusive).c or -1 otherwise.public static boolean regionMatches(CharSequence cs,
boolean ignoreCase,
int csStart,
CharSequence string,
int start,
int length)
cs - the CharSequence to be processedignoreCase - specifies if case should be ignored.csStart - the starting offset in the cs CharSequencestring - the CharSequence to compare.start - the starting offset in the specified string.length - the number of characters to compare.true if the ranges of characters are equal, false otherwise.