mirror of
https://github.com/java-diff-utils/java-diff-utils.git
synced 2026-03-13 10:11:17 +08:00
add apply patch example
This commit is contained in:
23
test/examples/diffutils/Example.java
Normal file
23
test/examples/diffutils/Example.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package diffutils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class Example {
|
||||
public static List<String> fileToLines(String filename) {
|
||||
List<String> lines = new LinkedList<String>();
|
||||
String line = "";
|
||||
try {
|
||||
BufferedReader in = new BufferedReader(new FileReader(filename));
|
||||
while ((line = in.readLine()) != null) {
|
||||
lines.add(line);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user