Package org.summerboot.jexpress.util
Class FormatterUtil
java.lang.Object
org.summerboot.jexpress.util.FormatterUtil
- Author:
- Changski Tie Zheng Zhang 张铁铮, 魏泽北, 杜旺财, 杜富贵
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final shortstatic final String[]static Patternstatic final longprotected static org.apache.logging.log4j.Loggerstatic final shortstatic final Stringstatic final Stringstatic final Patternstatic final Stringstatic final Patternstatic final Patternstatic final Stringstatic final Stringstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T[]arrayAdd(T[] array1, T newElement) static <T> T[]arrayCopy(T[] array1, T[] array2) static Stringstatic byte[]base64Decode(String encodedMime) static Stringbase64Encode(byte[] contentBytes) static byte[]base64MimeDecode(String encodedMime) static Stringbase64MimeEncode(byte[] contentBytes) static Stringstatic <T> Set<T>findDuplicates(List<T> listContainingDuplicates) static String[]getEnumNames(Class<? extends Enum<?>> e) static StringgetInsideParenthesesValue(String value) parseBindingAddresss(String bindAddresses) static String[]static String[]static voidparseFormParam(String formBody, Map<String, String> queryParam) Will not break on #static voidparseFormParam_Netty(String formBody, Map<String, String> queryParam) Break on #static byte[]For old Java before Java 17 HexFormat.of().parseHex(s)static String[]parseLines(String txt) static String[]static String[]static StringparseUrlQueryParam(String url, Map<String, String> queryParam) static StringparseUrlQueryParamEx(String url, Map<String, String> queryParam) Deprecated.static Stringstatic StringprotectContentNumber(String plain, String keyword, String delimiter, String replaceWith) static StringprotectFormParam(String formRequest, String key, String replaceWith) static StringprotectJsonArray(String json, String key, String replaceWith) static StringprotectJsonNumber(String json, String key, String replaceWith) static StringprotectJsonNumber_InString(String json, String key, String replaceWith) static StringprotectJsonString(String json, String key, String replaceWith) static StringprotectJsonString_InString(String json, String key, String replaceWith) static String[]splitByLength(String plain, int chunckSize) static byte[]toByteArray(BufferedImage bi, String format) static <T> StringtoCSV(Collection<T> a) static StringtoString(ByteBuffer buffer) static StringtoString(ByteBuffer buffer, boolean showStatus, boolean showHeaderfooter, int showNumberOfBytesPerLine, String delimiter) static StringupdateProtectedLine(String line, boolean encrypt) static StringupdateProtectedLine_(String line, boolean encrypt) Deprecated.
-
Field Details
-
log
protected static org.apache.logging.log4j.Logger log -
INT_MASK
public static final long INT_MASK- See Also:
-
SHORT_MASK
public static final int SHORT_MASK- See Also:
-
BYTE_MASK
public static final short BYTE_MASK- See Also:
-
NIBBLE_MASK
public static final short NIBBLE_MASK- See Also:
-
EMPTY_STR_ARRAY
-
REGEX_CSV
- See Also:
-
REGEX_URL
- See Also:
-
REGEX_BINDING_MAP
- See Also:
-
REGEX_EMAIL
- See Also:
-
REGEX_EMAIL_PATTERN
-
INSIDE_PARENTHESES_VALUE
-
REGEX_FIRST_AND_LAST_B
- See Also:
-
REGEX_DEC_PATTERN
-
REGEX_ENC_PATTERN
-
-
Constructor Details
-
FormatterUtil
public FormatterUtil()
-
-
Method Details
-
parseLines
-
parseDsv
-
parseCsv
-
parseURL
-
parseURL
-
parseUrlQueryParam
-
parseUrlQueryParamEx
Deprecated. -
parseFormParam_Netty
Break on #- Parameters:
formBody-queryParam-
-
parseFormParam
Will not break on #- Parameters:
formBody-queryParam-
-
toCSV
-
getEnumNames
-
getInsideParenthesesValue
-
updateProtectedLine
public static String updateProtectedLine(String line, boolean encrypt) throws GeneralSecurityException - Throws:
GeneralSecurityException
-
updateProtectedLine_
@Deprecated public static String updateProtectedLine_(String line, boolean encrypt) throws GeneralSecurityException Deprecated.- Throws:
GeneralSecurityException
-
b2n
-
parseBindingAddresss
-
parseMap
-
convertTo
public static String convertTo(String value, String targetCharsetName) throws UnsupportedEncodingException - Throws:
UnsupportedEncodingException
-
base64MimeEncode
-
base64MimeDecode
-
base64Encode
-
base64Decode
-
toByteArray
- Parameters:
bi-format- - png- Returns:
- Throws:
IOException- ImageIO failed to access system cache dir
-
toString
-
toString
public static String toString(ByteBuffer buffer, boolean showStatus, boolean showHeaderfooter, int showNumberOfBytesPerLine, String delimiter) -
parseHex
For old Java before Java 17 HexFormat.of().parseHex(s)- Parameters:
hexString- must be an even-length string- Returns:
-
findDuplicates
-
protectContentNumber
-
protectContent
-
protectJsonString
-
protectJsonString_InString
-
protectJsonNumber
-
protectJsonNumber_InString
-
protectJsonArray
-
protectFormParam
-
splitByLength
-
arrayCopy
public static <T> T[] arrayCopy(T[] array1, T[] array2) -
arrayAdd
public static <T> T[] arrayAdd(T[] array1, T newElement)
-