Maintains a checksum embedded as a comment within a checksummed text file. This allows to find out if the file has been changed without keeping a backup copy or a checksum in a separate file.
Public Member Functions | |
| ChecksumEmbedder (File file) | |
| String | computeChecksum () |
| Force computation of the files current checksum. | |
| String | checksum () |
| Returns the checksum most recently computed. | |
| String | fetchChecksum () |
| Extracts the currently embedded checksum from the text file. | |
| String | embeddedSum () |
| Returns the most recently fetched checksum. | |
| boolean | isAltered () |
| Check if a file has been altered since the last time the checksum was updated. | |
| void | embedChecksum (String prefix) throws DirectorException |
| Computes the current checksum and updates the copy embedded in the file. | |
Package Attributes | |
| File | file = null |
| String | checksum = null |
| String | extractedSum = null |
Static Package Attributes | |
| static final String | magic = "nodedirector checksum:" |
|
|
|
|
|
Returns the checksum most recently computed. If no checksum has ever been computed, invokes computeChecksum first. |
|
|
Force computation of the files current checksum.
|
|
|
Computes the current checksum and updates the copy embedded in the file. If no checksum has ever been embedded in the file, a new line containing the embedded checksum is added to the file. The string actually written to the file is prefixed with the given prefix string (usually a comment start string). |
|
|
Returns the most recently fetched checksum. If fetchChecksum() has not yet been invoked, runs fetchChecksum() first. |
|
|
Extracts the currently embedded checksum from the text file.
|
|
|
Check if a file has been altered since the last time the checksum was updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
1.4.5