MCPcopy Create free account
hub / github.com/ChenSen5/api_autotest / Md5Function

Class Md5Function

src/main/java/com/sen/api/functions/Md5Function.java:9–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7import org.apache.commons.codec.digest.DigestUtils;
8
9public class Md5Function implements Function{
10
11 @Override
12 public String execute(String[] args) {
13 try {
14 String filePath = args[0];
15 if (filePath.startsWith("http")) {
16 return DigestUtils.md5Hex(new URL(filePath).openStream());
17 } else {
18 return DigestUtils.md5Hex(new FileInputStream(new File(
19 filePath)));
20 }
21 } catch (Exception e) {
22 // TODO Auto-generated catch block
23 e.printStackTrace();
24 }
25 return null;
26 }
27
28 @Override
29 public String getReferenceKey() {
30 // TODO Auto-generated method stub
31 return "md5";
32 }
33
34}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected