CodeFormatter v1.0
==================
A CodeFormatter bean is used to format raw Java code. It indents, word-wraps,
and replaces tab characters with space characters. While intended mainly for
formatting machine-generated code, it can also be used on hand-written code.
 

Unzipping should create:
-----------------------

  README        This file.

  changes.html  List of changes to CodeFormatter.
 
  License.txt   Self-explanatory.

  doc/api       API documentation (javadoc).

  demos/        CodeFormatter demo - see demos\README for instructions on
                  how to run.

  lib/          jar files
                  cf.jar - jar file with CodeFormatter class files. Put this
                             in your classpath.

  src/          CodeFormatter source.
 

Description of Classes:
----------------------
com.ibm.cf.CFDriver - An example of how to use a CodeFormatter bean. The
                      CFDriver is a stand-alone tool that will instantiate
                      a CodeFormatter bean, configure it according to your
                      command-line arguments, and invoke the formatting.
                      Since the default source of input is stdin, and the
                      default target for output is stdout, a CFDriver can
                      also be used as a filter. It basically exposes all
                      the properties of a CodeFormatter bean as command-line
                      arguments.

com.ibm.cf.CodeFormatter - See description at top of file.

com.ibm.cf.IndentWriter  - Used internally by CodeFormatter.
 

To Run as a Stand-Alone Application:
-----------------------------------
Usage:

  java com.ibm.cf.CFDriver [args]

    args:

      [-in      fileName]   default: <STDIN>
      [-out     fileName]   default: <STDOUT>
      [-maxLine   length]   default: 74
      [-step        size]   default: 2
      [-delim      group]   default: (+
      [-sdelim     group]   default: ,
 

  Explanation of [args] (see the apidocs for more info)
  -----------------------------------------------------
  -in       ->      The name of the file to read from.

  -out      ->      The name of the file to write the formatted code to.

  -maxLine  ->      The (desired) maximum line length of the formatted code.

  -step     ->      IndentationStep: The number of space characters to indent
                      lines (when appropriate).

  -delim    ->      Delimiters: When a CodeFormatter encounters one of these
                      characters at or past the maximum line length, it will end
                      the line, and start the next line with the delimiter.

  -sdelim   ->      StickyDelimiters: When a CodeFormatter encounters one of
                      these characters at or past the maximum line length, it
                      will print the StickyDelimiter on the current line, and
                      then end the line.
 

To Use as a Bean
----------------
To create and use a CodeFormatter, you simply instantiate a new CodeFormatter
bean, and invoke formatCode(Reader source, Writer target) with appropriate
arguments. View the API docs for descriptions of the various properties of
the bean.
 

Some Hints
----------
Setting the maximum line length to a very large number, and the IndentationStep
to 0, will result in a file having all its indentation removed, and no lines
will be word-wrapped.
 

Contact Information
-------------------
Matthew J. Duftler (duftler@us.ibm.com)
IBM TJ Watson Research Center
30 Saw Mill River Road
Hawthorne, NY 10532
USA.