Package org.apache.hadoop.hdfs.util
Class MD5FileUtils
java.lang.Object
org.apache.hadoop.hdfs.util.MD5FileUtils
Static functions for dealing with files of the same format
that the Unix "md5sum" utility writes.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.hadoop.io.MD5HashcomputeMd5ForFile(File dataFile) Read dataFile and compute its MD5 checksum.static FilegetDigestFileForFile(File file) static org.apache.hadoop.io.MD5HashreadStoredMd5ForFile(File dataFile) Read the md5 checksum stored alongside the given data file.static voidrenameMD5File(File oldDataFile, File newDataFile) static voidsaveMD5File(File dataFile, org.apache.hadoop.io.MD5Hash digest) Save the ".md5" file that lists the md5sum of another file.static voidverifySavedMD5(File dataFile, org.apache.hadoop.io.MD5Hash expectedMD5) Verify that the previously saved md5 for the given file matches expectedMd5.
-
Field Details
-
MD5_SUFFIX
- See Also:
-
-
Constructor Details
-
MD5FileUtils
public MD5FileUtils()
-
-
Method Details
-
verifySavedMD5
public static void verifySavedMD5(File dataFile, org.apache.hadoop.io.MD5Hash expectedMD5) throws IOException Verify that the previously saved md5 for the given file matches expectedMd5.- Throws:
IOException
-
readStoredMd5ForFile
Read the md5 checksum stored alongside the given data file.- Parameters:
dataFile- the file containing data- Returns:
- the checksum stored in dataFile.md5
- Throws:
IOException
-
computeMd5ForFile
Read dataFile and compute its MD5 checksum.- Throws:
IOException
-
saveMD5File
public static void saveMD5File(File dataFile, org.apache.hadoop.io.MD5Hash digest) throws IOException Save the ".md5" file that lists the md5sum of another file.- Parameters:
dataFile- the original file whose md5 was computeddigest- the computed digest- Throws:
IOException
-
renameMD5File
- Throws:
IOException
-
getDigestFileForFile
- Returns:
- a reference to the file with .md5 suffix that will contain the md5 checksum for the given data file.
-