Révision 1325
tmp/org.txm.utils/src/org/txm/utils/io/IOUtils.java (revision 1325) | ||
---|---|---|
207 | 207 |
return new BufferedOutputStream(new FileOutputStream(file, append)); |
208 | 208 |
} |
209 | 209 |
|
210 |
public static void replaceAll(File file, String oldString, String newString) throws IOException {
|
|
210 |
public static void replace(File file, String oldString, String newString) throws IOException { |
|
211 | 211 |
String text = getText(file, "UTF-8"); |
212 | 212 |
text = text.replace(oldString, newString); |
213 | 213 |
IOUtils.write(file, text); |
214 | 214 |
} |
215 |
|
|
216 |
public static void replaceAll(File file, Pattern regex, String newString) throws IOException { |
|
217 |
String text = getText(file, "UTF-8"); |
|
218 |
text = regex.matcher(text).replaceAll(newString); |
|
219 |
IOUtils.write(file, text); |
|
220 |
} |
|
215 | 221 |
} |
Formats disponibles : Unified diff