java.lang.Object
one.jpro.platform.image.manager.ImageUtils
This class provides utility methods for various image operations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longcomputeHashValue(byte[] data) Computes the MD5 hash of the given data and returns the first 8 bytes of the hash as a long value.static StringescapeJson(String str) Escapes certain special characters in a JSON string to ensure it's valid.
-
Constructor Details
-
ImageUtils
public ImageUtils()
-
-
Method Details
-
computeHashValue
public static long computeHashValue(byte[] data) Computes the MD5 hash of the given data and returns the first 8 bytes of the hash as a long value.- Parameters:
data- The input data for which the hash needs to be computed.- Returns:
- The first 8 bytes of the MD5 hash as a long value.
- Throws:
RuntimeException- if there's an error computing the hash.
-
escapeJson
Escapes certain special characters in a JSON string to ensure it's valid. Specifically, it escapes backslashes and double quotes.- Parameters:
str- The input JSON string that might contain characters to be escaped.- Returns:
- The input string with necessary characters escaped.
-