001    package org.springframework.beans;
002    
003    import java.io.File;
004    import java.util.Set;
005    
006    public class ContentRemover {
007    
008        public boolean removeContent(File file, Set<String> contentsToRemove) {
009            String content = CopyrightHandlerTest.read(file);
010            content = CopyrightHandlerTest.flatten(content);
011    
012            boolean updated = false;
013            for (String contentToRemove : contentsToRemove) {
014                int pos = content.indexOf(contentToRemove);
015                if (pos != -1) {
016                    content = content.replace(contentToRemove, "");
017                    updated = true;
018                }
019            }
020            if (!updated) {
021                return false;
022            } else {
023                content = CopyrightHandlerTest.unflatten(content);
024                CopyrightHandlerTest.write(file, content);
025                return true;
026            }
027        }
028    
029    }