All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class bradel.wordchanger.WordChanger

java.lang.Object
   |
   +----bradel.wordchanger.WordChanger

public class WordChanger
extends Object
WordChanger reads in a set of java files and changes all of the method and variable names so as to make the files hard to read once they are compiled. This will not work with escape sequences, so A will not be translated to an 'a'. Values that will be replaced are all of the form: [a-zA-Z][0-9a-zA-z_]* so the Java behaviour of using dollar signs and whatever else is not considered. String constants will be ignored. Comments will be ignored. This program does not examine the java program structure to identify keywords which should not be changed. Words that are not to be changed are either java keywords or are specified in a set of files. Creation date: (30/12/2001 1:34:00 PM)

Author:
: Borys Bradel Copyright (c) 2001 Borys Bradel All rights reserved Command prompt: If no parameters, reads WordChanger.cfg as the default configuration file. Otherwise the first parameter has to be the name of the configuration file. Configuration file format: Each line has to be a tag word followed by one or more tokens (as specified by StringTokenizer. If a tag is omitted then what is in square brackets is assumed. The lines are as follows: {base_directory some_directory [default=""]} {package_directory some_directory [default=""]} {changed_file_directory some_directory [default="changed"]} {prefix some_prefix [default="bb"]} {exclude_from file1 file2 ... [default: none]} {not_scanned file1 file2 ... [default: none]} {debug boolean_value [default: false]} {conversion_data_file file_name [default=null]} {reverse_from file_name [default=null]} The directories are combined as follows to look for java source code files: base_directory + package_directory for input files and base_directory + changed_file_directory + package_directory for output files. The java file names are just concatenated with these directory names, so they must have a / at the end (also, whether to use a / or a \ may be system specific).

Variable Index

 o CFGBASEDIRTAG
identifies a base directory
 o CFGCHANGEDFILEDIRTAG
identifies the changed file directory
 o CFGDEBUGTAG
identifies whether there should be debugging output
 o CFGEXCLUDELISTFILETAG
identifies the files that contain the words to exclude
 o CFGNOTSCANNEDFILESTAG
identifies the files that are not to be scanned
 o CFGOUTPUTCONVERSIONDATATAG
identifies where to store the conversion data, if any
 o CFGPACKAGEDIRTAG
identifies the package directory
 o CFGPREFIXTAG
identifies what prefix to use
 o CFGREVERSECONVERSIONDATATAG
forces a reverse conversion based on some file
 o debug
by default debug output is off
 o DEFAULTCFGFILE
default file name for the configeration file
 o KEYWORDS
java keywords, not to be changed

Constructor Index

 o WordChanger()
WordChanger constructor does nothing

Method Index

 o createNewFiles(String[], String[], LineScanner)
Read the file, save the new file to a string, and then overwrite the old file.
 o createWordDataStorage(String[], LineScanner)
Record what has to be changed in all of the files.
 o main(String[])
Starts the application.

Variables

 o KEYWORDS
 private static final String KEYWORDS[]
java keywords, not to be changed

 o DEFAULTCFGFILE
 private static final String DEFAULTCFGFILE
default file name for the configeration file

 o CFGBASEDIRTAG
 private static final String CFGBASEDIRTAG
identifies a base directory

 o CFGPACKAGEDIRTAG
 private static final String CFGPACKAGEDIRTAG
identifies the package directory

 o CFGCHANGEDFILEDIRTAG
 private static final String CFGCHANGEDFILEDIRTAG
identifies the changed file directory

 o CFGEXCLUDELISTFILETAG
 private static final String CFGEXCLUDELISTFILETAG
identifies the files that contain the words to exclude

 o CFGNOTSCANNEDFILESTAG
 private static final String CFGNOTSCANNEDFILESTAG
identifies the files that are not to be scanned

 o CFGPREFIXTAG
 private static final String CFGPREFIXTAG
identifies what prefix to use

 o CFGDEBUGTAG
 private static final String CFGDEBUGTAG
identifies whether there should be debugging output

 o CFGOUTPUTCONVERSIONDATATAG
 private static final String CFGOUTPUTCONVERSIONDATATAG
identifies where to store the conversion data, if any

 o CFGREVERSECONVERSIONDATATAG
 private static final String CFGREVERSECONVERSIONDATATAG
forces a reverse conversion based on some file

 o debug
 private static boolean debug
by default debug output is off

Constructors

 o WordChanger
 public WordChanger()
WordChanger constructor does nothing

Methods

 o createNewFiles
 public static void createNewFiles(String fileNameArray[],
                                   String fileNameOutArray[],
                                   LineScanner lineScanner)
Read the file, save the new file to a string, and then overwrite the old file. Creation date: (30/12/2001 5:44:11 PM)

Parameters:
fileNameArray - java.lang.String[]
fileNameOutArray - java.lang.String[]
lineScanner - bradel.wordchanger.LineScanner
 o createWordDataStorage
 public static void createWordDataStorage(String fileNameArray[],
                                          LineScanner lineScanner)
Record what has to be changed in all of the files. Creation date: (30/12/2001 5:38:12 PM)

Parameters:
fileNameArray - java.lang.String[]
lineScanner - bradel.wordchanger.LineScanner
 o main
 public static void main(String args[])
Starts the application.

Parameters:
args - an array of command-line arguments

All Packages  Class Hierarchy  This Package  Previous  Next  Index