public class AddAHead
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.lang.String[] |
commentsend |
private java.lang.String[] |
commentsstart |
private int[] |
countAddFile |
private int[] |
countCode |
private int[] |
countComment |
private int[] |
countEmpty |
private int[] |
countFile |
private int[] |
countRemoveFile |
private static java.lang.String[] |
endings |
private java.lang.String[] |
header |
private java.lang.String[] |
noendingFiles |
private java.lang.String[] |
notToRemove |
private java.lang.String[] |
oldHeader |
private java.io.File |
tmpFile |
Constructor and Description |
---|
AddAHead() |
Modifier and Type | Method and Description |
---|---|
void |
addHeader(java.io.File f,
int type) |
int |
containsHeader(java.io.File f,
int type) |
java.lang.String |
ending(java.lang.String fn) |
java.io.BufferedReader |
getBufferedReader(java.io.File file) |
void |
handleFile(java.io.File f) |
static int[] |
initCounter() |
static void |
main(java.lang.String[] args)
searches files for old and new headers.
|
void |
readHeader(java.lang.String f) |
java.lang.String[] |
readLines(java.lang.String f) |
void |
readOldHeader(java.lang.String f) |
void |
removeOldHeader(java.io.File f,
int type) |
boolean |
startsWithOne(java.lang.String s0,
java.lang.String[] s) |
java.lang.String |
statistics() |
private static int |
sum(int[] is) |
java.lang.String |
summary(java.lang.String ending,
int countFile,
int countRemoveFile,
int countAddFile,
int countCode,
int countComment,
int countEmpty) |
void |
visitFile(java.io.File currentFile) |
private static java.lang.String[] endings
private java.lang.String[] commentsstart
private java.lang.String[] noendingFiles
private java.lang.String[] commentsend
private java.lang.String[] notToRemove
private java.lang.String[] header
private java.lang.String[] oldHeader
private java.io.File tmpFile
private int[] countCode
private int[] countComment
private int[] countEmpty
private int[] countFile
private int[] countAddFile
private int[] countRemoveFile
public java.io.BufferedReader getBufferedReader(java.io.File file)
public static int[] initCounter()
public java.lang.String ending(java.lang.String fn)
public boolean startsWithOne(java.lang.String s0, java.lang.String[] s)
public int containsHeader(java.io.File f, int type) throws java.io.IOException
java.io.IOException
public void addHeader(java.io.File f, int type) throws java.io.IOException
java.io.IOException
public void removeOldHeader(java.io.File f, int type) throws java.io.IOException
java.io.IOException
public void handleFile(java.io.File f) throws java.io.IOException
java.io.IOException
public void visitFile(java.io.File currentFile) throws java.io.IOException
java.io.IOException
public java.lang.String summary(java.lang.String ending, int countFile, int countRemoveFile, int countAddFile, int countCode, int countComment, int countEmpty)
private static int sum(int[] is)
public java.lang.String statistics()
public void readHeader(java.lang.String f)
public java.lang.String[] readLines(java.lang.String f)
public void readOldHeader(java.lang.String f)
public static void main(java.lang.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.