Top Constructors Methods
org.apache.hc.core5.util

public final Class TextUtils

extends Object
Class Inheritance
Imports
java.util.Locale, org.apache.hc.core5.annotation.Internal

Since
4.3

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static byte
castAsByte(final int c)

Casts character to byte filtering non-visible and non-ASCII characters before conversion

public static boolean
public static boolean

Returns:

true if the CharSequence is null, empty or whitespace only
isBlank
(final CharSequence
the CharSequence to check, may be null
s
)

Checks if a CharSequence is empty (""), null or whitespace only.

public static boolean
isEmpty(final CharSequence s)

Returns true if the parameter is null or of zero length

public static int

Returns:

CharSequence length or 0 if the CharSequence is null.
length
(final CharSequence
a CharSequence or null
cs
)

Gets a CharSequence length or 0 if the CharSequence is null.

public static String

Returns:

hex string for the bytes
toHexString
(final byte[]
whose hex string should be created
bytes
)

Returns a hexadecimal string with lowercase letters, representing the values of the bytes.

public static String
toLowerCase(final String s)

Returns lower case representation of the given string using Locale#ROOT.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

TextUtilsback to summary
private TextUtils()

Method Detail

castAsByteback to summary
public static byte castAsByte(final int c)

Casts character to byte filtering non-visible and non-ASCII characters before conversion

Annotations
@Internal
Since
5.2
containsBlanksback to summary
public static boolean containsBlanks(final CharSequence s)
Since
4.4
isBlankback to summary
public static boolean isBlank(final CharSequence s)

Checks if a CharSequence is empty (""), null or whitespace only.

Whitespace is defined by Character#isWhitespace(char).

TextUtils.isBlank(null)      = true
TextUtils.isBlank("")        = true
TextUtils.isBlank(" ")       = true
TextUtils.isBlank("abg")     = false
TextUtils.isBlank("  abg  ") = false
Parameters
s:CharSequence

the CharSequence to check, may be null

Returns:boolean

true if the CharSequence is null, empty or whitespace only

isEmptyback to summary
public static boolean isEmpty(final CharSequence s)

Returns true if the parameter is null or of zero length

lengthback to summary
public static int length(final CharSequence cs)

Gets a CharSequence length or 0 if the CharSequence is null.

Parameters
cs:CharSequence

a CharSequence or null

Returns:int

CharSequence length or 0 if the CharSequence is null.

Since
5.1
toHexStringback to summary
public static String toHexString(final byte[] bytes)

Returns a hexadecimal string with lowercase letters, representing the values of the bytes.

Parameters
bytes:byte[]

whose hex string should be created

Returns:String

hex string for the bytes

Since
5.0
toLowerCaseback to summary
public static String toLowerCase(final String s)

Returns lower case representation of the given string using Locale#ROOT.

Since
5.2