Class StringUtils
- java.lang.Object
-
- org.apache.jackrabbit.oak.commons.StringUtils
-
public class StringUtils extends java.lang.ObjectSome string utility methods.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static @NotNull java.lang.StringconvertBytesToHex(@org.jetbrains.annotations.NotNull byte[] value)Convert a byte array to a hex encoded string.static @org.jetbrains.annotations.NotNull byte[]convertHexToBytes(@NotNull java.lang.String s)Convert a hex encoded string to a byte array.static java.lang.StringemptyToNull(@Nullable java.lang.String string)Returns the string if it is not empty, ornullotherwise.static intestimateMemoryUsage(java.lang.String s)Estimates the memory usage of the given string.
-
-
-
Method Detail
-
convertBytesToHex
@NotNull public static @NotNull java.lang.String convertBytesToHex(@NotNull @org.jetbrains.annotations.NotNull byte[] value)Convert a byte array to a hex encoded string.- Parameters:
value- the byte array- Returns:
- the hex encoded string
-
convertHexToBytes
@NotNull public static @org.jetbrains.annotations.NotNull byte[] convertHexToBytes(@NotNull @NotNull java.lang.String s)Convert a hex encoded string to a byte array.- Parameters:
s- the hex encoded string- Returns:
- the byte array
-
estimateMemoryUsage
public static int estimateMemoryUsage(java.lang.String s)
Estimates the memory usage of the given string.- Parameters:
s- the string to estimate.- Returns:
- the estimated memory usage.
-
emptyToNull
public static java.lang.String emptyToNull(@Nullable @Nullable java.lang.String string)Returns the string if it is not empty, ornullotherwise.- Parameters:
string- the string to test and possibly return, may benull- Returns:
- the input string if it is not empty, or
nullif the input string isnullor empty
-
-