Package ghidra.formats.gfilesystem
Class FileFingerprintCache
- java.lang.Object
-
- ghidra.formats.gfilesystem.FileFingerprintCache
-
public class FileFingerprintCache extends java.lang.Object
A best-effort cache of MD5 values of local files based on their {name,timestamp,length} fingerprint.Used to quickly verify that a local file hasn't changed.
-
-
Constructor Summary
Constructors Constructor Description FileFingerprintCache()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(java.lang.String path, java.lang.String md5, long timestamp, long length)
Add a file's fingerprint to the cache.void
clear()
Clears the cache.boolean
contains(java.lang.String path, java.lang.String md5, long timestamp, long length)
Returns true if the specified file with the specified fingerprints (timestamp, length) was previously added to the cache with the specified md5.java.lang.String
getMD5(java.lang.String path, long timestamp, long length)
Retrieves the md5 for the specified file that has the specified fingerprint (timestamp, length).
-
-
-
Method Detail
-
clear
public void clear()
Clears the cache.
-
add
public void add(java.lang.String path, java.lang.String md5, long timestamp, long length)
Add a file's fingerprint to the cache.- Parameters:
path
- String path to the filemd5
- hex-string md5 of the filetimestamp
- long last modified timestamp of the filelength
- long file size
-
contains
public boolean contains(java.lang.String path, java.lang.String md5, long timestamp, long length)
Returns true if the specified file with the specified fingerprints (timestamp, length) was previously added to the cache with the specified md5.- Parameters:
path
- String path to the filemd5
- hex-string md5 of the filetimestamp
- long last modified timestamp of the filelength
- long file size- Returns:
- true if the fingerprint has previously been added to the cache.
-
getMD5
public java.lang.String getMD5(java.lang.String path, long timestamp, long length)
Retrieves the md5 for the specified file that has the specified fingerprint (timestamp, length).- Parameters:
path
- String path to the filetimestamp
- long last modified timestamp of the filelength
- long file size- Returns:
- hex-string md5 or null if not present in the cache.
-
-