Package org.savantbuild.security
Class MD5Tools
java.lang.Object
org.savantbuild.security.MD5Tools
This class provides some common IO tools.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MD5write(InputStream is, OutputStream os, MD5 md5) Reads from the given input stream and writes the contents out to the given OutputStream.
-
Constructor Details
-
MD5Tools
public MD5Tools()
-
-
Method Details
-
write
Reads from the given input stream and writes the contents out to the given OutputStream. During the write, the MD5 sum from input stream is calculated and compared with the given MD5 sum. This does not close the InputStream but DOES close the OutputStream so that the data gets flushed out correctly.- Parameters:
is- The InputStream to read from. This InputStream is wrapped in a BufferedInputStream for performance.os- The OutputStream to write to.md5- (Optional) The MD5 sum to check against.- Returns:
- The MD5 checksum of the file that was written out. This helps in case the caller needs the sum and the parameter is not given.
- Throws:
IOException- If the output operation fails.MD5Exception- If the MD5 check failed.
-