|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.avalon.framework.logger.AbstractLoggable | +--org.apache.cocoon.components.language.programming.java.JstyleFormatter
This class implements CodeFormatter
based on
Tal Davidson's (davidsont@bigfoot.com) Jstyle Java
beautifier. This implementation is very improvised...
Field Summary | |
protected static int |
LINE_LENGTH_DEVIATION
The default line length deviation. |
protected static int |
PREFERRED_LINE_LENGTH
The default preferred line length. |
protected static int |
SPACE_INDENTATION
The default space indentation. |
Constructor Summary | |
JstyleFormatter()
|
Method Summary | |
java.lang.String |
format(java.lang.String code,
java.lang.String encoding)
Format and beautify a String containing source code.
|
protected java.lang.String |
getString(java.io.ByteArrayOutputStream out,
java.lang.String encoding)
Convert a byte array stream to string according to a given encoding. |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLoggable |
getLogger, setLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final int PREFERRED_LINE_LENGTH
protected static final int LINE_LENGTH_DEVIATION
protected static final int SPACE_INDENTATION
Constructor Detail |
public JstyleFormatter()
Method Detail |
public java.lang.String format(java.lang.String code, java.lang.String encoding)
String
containing source code.
This class has 2 pases: one for beautifying and another one for
indentation. This should be performed in a single step!!!
format
in interface CodeFormatter
code
- The input source codeencoding
- The encoding used for constant strings embedded in the
source code
protected java.lang.String getString(java.io.ByteArrayOutputStream out, java.lang.String encoding) throws java.io.UnsupportedEncodingException
null
for the platform's default
encoding
EXCEPTION_NAME
- If an error occurs
java.io.UnsupportedEncodingException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |