1 package org.springframework.beans;
2
3 import java.io.File;
4 import java.util.Set;
5
6 public class ContentRemover {
7
8 public boolean removeContent(File file, Set<String> contentsToRemove) {
9 String content = CopyrightHandlerTest.read(file);
10 content = CopyrightHandlerTest.flatten(content);
11
12 boolean updated = false;
13 for (String contentToRemove : contentsToRemove) {
14 int pos = content.indexOf(contentToRemove);
15 if (pos != -1) {
16 content = content.replace(contentToRemove, "");
17 updated = true;
18 }
19 }
20 if (!updated) {
21 return false;
22 } else {
23 content = CopyrightHandlerTest.unflatten(content);
24 CopyrightHandlerTest.write(file, content);
25 return true;
26 }
27 }
28
29 }