Hi all, I wrote test case on APIDocDownload for the API Manager .When I Run the tests It gives me two md5sums for equal files .
here's the code sample I write to get md5 value from the files private String readMD5(InputStream inputStream) throws > NoSuchAlgorithmException, IOException { > MessageDigest md = MessageDigest.getInstance("MD5"); > byte[] dataBytes = new byte[1024]; > int read; > try { > while ((read = inputStream.read(dataBytes)) != -1) { > md.update(dataBytes, 0, read); > } > } catch (IOException e) { > log.error("File couldn't found to read md5", e); > throw e; > } finally { > inputStream.close(); > } > byte[] mdBytes = md.digest(); > //convert the byte to hex format > StringBuilder sb = new StringBuilder(); > for (byte mdByte : mdBytes) { > sb.append(Integer.toString((mdByte & 0xff) + 0x100, 16).substring(1)); > } > return sb.toString(); > } Is there any best way to get two files are identical ?. Thanks -- *Tharindu Dharmarathna*Associate Software Engineer WSO2 Inc.; http://wso2.com lean.enterprise.middleware mobile: *+94779109091 <%2B94779109091>*
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev