简体   繁体   中英

Detecting changes in text

I would like to know the name of a Java library which is able to detect changes in text in two text files (or Strings). I want to detect the changes on saving a java source file and ultimately want to know the name of the method on which a changes was performed.

If the details of the change aren't important (just that the files have changed) then you can use a hash (such as MD5) to detect that the change.

Otherwise you should use one of the diff utilities like this and then pair that with a source info library like QDox . You could use the diff utility to determine where the changes are, and then use QDox to determine the method start/end lines that are around the changes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM