Package com.sun.identity.tools.manifest
Class Utils
- java.lang.Object
-
- com.sun.identity.tools.manifest.Utils
-
- All Implemented Interfaces:
ManifestConstants
public class Utils extends Object implements ManifestConstants
-
-
Field Summary
-
Fields inherited from interface com.sun.identity.tools.manifest.ManifestConstants
ALL_SUFFIX, BUFFER_SIZE, DEFAULT_DIGEST_HANDLEJAR, DEFAULT_DIGEST_HANDLEWAR, DEFAULT_IDENTIFIER_ENTRY, DEFAULT_MANIFEST_FILE_NAME, DEFAULT_MANIFEST_PATTERN, DEFAULT_OVERWRITE, DEFAULT_RECURSIVE, DEFAULT_VERBOSE, DEFAULT_WILD_CARD, DEFAULT_WILDCARD_CHAR, DELETE_SUFFIX, DEST_FILE_PATH, DIGEST_ALG, DIGEST_HANDLEJAR, DIGEST_HANDLEWAR, DRYRUN_OPTION, EQUAL, EXCLUDE_PATTERN, FILE_SEPARATOR, HEADER_FILE_PATH, IDENTIFIER_ENTRY, IDENTIFIER_SEPARATOR, INCLUDE_PATTERN, JAR_FILE_EXT, LATEST_WAR_FILE, MANIFEST_CREATE_FILE, MANIFEST_FILE_NAME, MANIFEST_NAME, MANIFEST_PATTERN, OVERWRITE, PATTERN_SEPARATOR, PROPERTIES_FILE, RECURSIVE, SHA1, SRC_FILE_PATH, VERBOSE_OPTION, VERSION_FILE, WAR_FILE_EXT, WILDCARD_CHAR
-
-
Constructor Summary
Constructors Constructor Description Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]getHash(String algorithm, InputStream in)Calculate and return the hash value with byte array.static MessageDigesthashing(MessageDigest md, InputStream in)Run the hash with the pass in MessageDigest and InputStreamstatic booleanisMatch(String actualString, String pattern, char wildCard)Check whether the string matches the pattern.static booleanisMatch(String actualString, LinkedList patterns, char wildCard)Check whether the string matches the pattern.static StringtranslateHashToString(byte[] hash)Translate the byte array into Hex String.
-
-
-
Method Detail
-
hashing
public static MessageDigest hashing(MessageDigest md, InputStream in)
Run the hash with the pass in MessageDigest and InputStream- Parameters:
md- The MessageDigest to be used.in- The InputStream of the data to be hashed.- Returns:
- The MessageDigest object after doing the hashing.
-
getHash
public static byte[] getHash(String algorithm, InputStream in)
Calculate and return the hash value with byte array.- Parameters:
algorithm- The string to indicate the hashing algorithm to be used.in- The InputStream of the data to be hashed.- Returns:
- The hash value in byte array.
-
translateHashToString
public static String translateHashToString(byte[] hash)
Translate the byte array into Hex String.- Parameters:
hash- The byte array of hash value.- Returns:
- The string of the hash value in Hex.
-
isMatch
public static boolean isMatch(String actualString, LinkedList patterns, char wildCard)
Check whether the string matches the pattern.- Parameters:
actualString- The string to be checked.patterns- A list of patterns to check for.wildCard- A character which is used as wild card in the pattern.- Returns:
- Whether the string matches one of the patterns in the list.
-
isMatch
public static boolean isMatch(String actualString, String pattern, char wildCard)
Check whether the string matches the pattern.- Parameters:
actualString- The string to be checked.pattern- A pattern to check for.wildCard- A character which is used as wild card in the pattern.- Returns:
- Whether the string matches one of the patterns in the list.
-
-