public class AddAHead extends Object
Modifier and Type | Field and Description |
---|---|
private String[] |
commentsend |
private String[] |
commentsstart |
private int[] |
countAddFile |
private int[] |
countCode |
private int[] |
countComment |
private int[] |
countEmpty |
private int[] |
countFile |
private int[] |
countRemoveFile |
private static String[] |
endings |
private String[] |
header |
private String[] |
noendingFiles |
private String[] |
notToRemove |
private String[] |
oldHeader |
private File |
tmpFile |
Constructor and Description |
---|
AddAHead() |
Modifier and Type | Method and Description |
---|---|
void |
addHeader(File f,
int type) |
int |
containsHeader(File f,
int type) |
String |
ending(String fn) |
BufferedReader |
getBufferedReader(File file) |
void |
handleFile(File f) |
static int[] |
initCounter() |
static void |
main(String[] args)
searches files for old and new headers.
|
void |
readHeader(String f) |
String[] |
readLines(String f) |
void |
readOldHeader(String f) |
void |
removeOldHeader(File f,
int type) |
boolean |
startsWithOne(String s0,
String[] s) |
String |
statistics() |
private static int |
sum(int[] is) |
String |
summary(String ending,
int countFile,
int countRemoveFile,
int countAddFile,
int countCode,
int countComment,
int countEmpty) |
void |
visitFile(File currentFile) |
private static String[] endings
private String[] commentsstart
private String[] noendingFiles
private String[] commentsend
private String[] notToRemove
private String[] header
private String[] oldHeader
private File tmpFile
private int[] countCode
private int[] countComment
private int[] countEmpty
private int[] countFile
private int[] countAddFile
private int[] countRemoveFile
public BufferedReader getBufferedReader(File file)
public static int[] initCounter()
public int containsHeader(File f, int type) throws IOException
IOException
public void addHeader(File f, int type) throws IOException
IOException
public void removeOldHeader(File f, int type) throws IOException
IOException
public void handleFile(File f) throws IOException
IOException
public void visitFile(File currentFile) throws IOException
IOException
public String summary(String ending, int countFile, int countRemoveFile, int countAddFile, int countCode, int countComment, int countEmpty)
private static int sum(int[] is)
public String statistics()
public void readHeader(String f)
public void readOldHeader(String f)
public static void main(String[] args)
args
- First parameter contains the file to start from. If it
is a directory all files below that directory are
considered. Second parameter is a String describing the file where
the new header can be found. This file should be text without any
comment characters. The Third parameter is the filename of the old
header that is to be replaced by the new header. The third one is
optional.