Package org.summerboot.jexpress.util
Class FormatterUtil
java.lang.Object
org.summerboot.jexpress.util.FormatterUtil
- Author:
- Changski Tie Zheng Zhang 张铁铮, 魏泽北, 杜旺财, 杜富贵
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final shortstatic final String[]static final shortstatic final char[]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 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) static PatterngetPattern(String dataFieldName, FormatterUtil.RegexType type) 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 String[]static StringparseUrlQueryParam(String url, Map<String, String> queryParam) static StringparseUrlQueryParamEx(String url, Map<String, String> queryParam) Deprecated.static StringpreplaceFormParam(String formRequest, String key, String newValue) static Stringstatic StringprotectContentNumber(String plain, String keyword, String delimiter, String replaceWith) static StringreplaceDataField(String data, String key, String newValue) static StringreplaceDataField(FormatterUtil.RegexType type, String data, String key, String newValue) static StringreplaceJsonArray(String json, String key, String newValue) static StringreplaceJsonNumber(String json, String key, String newValue) static StringreplaceJsonNumber_InString(String json, String key, String replaceWith) static StringreplaceJsonString(String json, String key, String newValue) static StringreplaceJsonString_InString(String json, String key, String replaceWith) static StringreplaceXMLValue(String xml, String key, String newValue) static String[]splitByLength(String plain, int chunckSize) static byte[]toByteArray(BufferedImage bi, String format) static <T> StringtoCSV(Collection<T> a) static char[]toString(byte v, boolean append0x) replaced String.format("0x%02X", i) with better performance api, 100 times faster via byte operations: 10k loads performace: 317ms vs 2msstatic StringtoString(ByteBuffer buffer) static StringtoString(ByteBuffer buffer, boolean showStatus, boolean showHeaderfooter, int numberOfBytesPerLine) static StringtoString(ByteBuffer buffer, boolean showStatus, boolean showHeaderfooter, int numberOfBytesPerLine, String delimiter) static StringtoString(ByteBuffer buffer, boolean showStatus, boolean showHeaderfooter, int numberOfBytesPerLine, String delimiter, String br, String header, String footer) 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_PSV
- 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
-
HEX_STRING_SIZE
public static final short HEX_STRING_SIZE- See Also:
-
HexArrayIndexTable
public static final char[] HexArrayIndexTable
-
-
Constructor Details
-
FormatterUtil
public FormatterUtil()
-
-
Method Details
-
parseLines
-
parseDsv
-
parsePsv
-
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 numberOfBytesPerLine) -
toString
public static String toString(ByteBuffer buffer, boolean showStatus, boolean showHeaderfooter, int numberOfBytesPerLine, String delimiter) -
toString
-
toString
public static char[] toString(byte v, boolean append0x) replaced String.format("0x%02X", i) with better performance api, 100 times faster via byte operations: 10k loads performace: 317ms vs 2ms- Parameters:
v-- Returns:
-
parseHex
For old Java before Java 17 HexFormat.of().parseHex(s)- Parameters:
hexString- must be an even-length string- Returns:
-
findDuplicates
-
protectContentNumber
-
protectContent
-
getPattern
-
replaceDataField
public static String replaceDataField(FormatterUtil.RegexType type, String data, String key, String newValue) -
replaceDataField
-
replaceJsonString
-
replaceJsonNumber
-
replaceJsonArray
-
replaceXMLValue
-
preplaceFormParam
-
replaceJsonString_InString
-
replaceJsonNumber_InString
-
splitByLength
-
arrayCopy
public static <T> T[] arrayCopy(T[] array1, T[] array2) -
arrayAdd
public static <T> T[] arrayAdd(T[] array1, T newElement)
-