|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.PartReplace
public class PartReplace
Reads an ascii-file, keeps all the lines. Then it searches for a number of lines occuring in the file, replaces them with the argument and writes the updated file.
| Nested Class Summary | |
|---|---|
static class |
PartReplace.Insert
Inserts lines. |
static class |
PartReplace.Lines
Replaces part of a file. |
| Constructor Summary | |
|---|---|
PartReplace()
|
|
| Method Summary | |
|---|---|
static List<String> |
getAllLines(File ascii)
Read in an ascii-file and returns all files read as a list of strings. |
private static boolean |
hasHead(List<String> in,
List<String> check)
Returns true if all the elements at the first list at the end index are equal to the second list. |
static List<String> |
insertIf(List<String> input,
String scan,
List<String> head)
Scans the list for a line, if the lines before are not the equal to the head list, the head list is inserted before the scan line. |
static List<String> |
replace(List<String> input,
List<String> scan,
List<String> replace)
Converts a list of strings to a new one by comparing element-by-element if the occurence of the search argument is within the input list. |
private static boolean |
scanFor(List<String> test,
int index,
List<String> scan)
Scans if the next n-elements of the string list are equal to the string array. |
static void |
writeAllLines(File ascii,
List<String> output)
Writes an ascii-file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PartReplace()
| Method Detail |
|---|
public static List<String> getAllLines(File ascii)
public static void writeAllLines(File ascii,
List<String> output)
public static List<String> replace(List<String> input,
List<String> scan,
List<String> replace)
public static List<String> insertIf(List<String> input,
String scan,
List<String> head)
private static boolean hasHead(List<String> in,
List<String> check)
private static boolean scanFor(List<String> test,
int index,
List<String> scan)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||