Package org.jboss.jdeparser
Class SourceFileWriter
- java.lang.Object
-
- org.jboss.jdeparser.SourceFileWriter
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
class SourceFileWriter extends java.lang.Object implements java.io.Flushable, java.io.Closeable
-
-
Field Summary
Fields Modifier and Type Field Description private ImplJSourceFileclassFileprivate CountingWritercountingWriterprivate FormatPreferencesformatprivate java.util.ArrayList<Indent>indentStackprivate java.lang.StringBuilderlineBufferprivate java.lang.StringlineSepprivate IndentnextIndentprivate intspaceStateprivate static intSS_2_NEW_LINEprivate static intSS_ADDEDprivate static intSS_NEEDEDprivate static intSS_NEW_LINEprivate static intSS_NONEprivate java.util.ListIterator<Indent>stackIteratorprivate Tokenstateprivate java.util.ArrayDeque<AbstractJType>thisTypeStack
-
Constructor Summary
Constructors Constructor Description SourceFileWriter(FormatPreferences format, java.io.Writer writer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidaddIndent()(package private) voidaddWordSpace()voidclose()voidflush()(package private) ImplJSourceFilegetClassFile()(package private) intgetColumn()(package private) FormatPreferencesgetFormat()(package private) intgetLine()(package private) TokengetState()(package private) AbstractJTypegetThisType()(package private) voidnl()(package private) voidntsp()A non-trailing space.(package private) voidpopIndent(FormatPreferences.Indentation indentation)(package private) voidpopIndent(Indent indent)(package private) voidpopThisType(AbstractJType thisType)(package private) voidprocessSpacing()(package private) voidpushIndent(FormatPreferences.Indentation indentation)(package private) voidpushIndent(Indent indent)(package private) voidpushThisType(AbstractJType thisType)(package private) voidsetClassFile(ImplJSourceFile classFile)(package private) voidsp()Force a space if one hasn't already been added.(package private) voidwrite(AbstractJExpr expr)(package private) voidwrite(AbstractJType type)(package private) voidwrite(FormatPreferences.Space rule)(package private) voidwrite(JExpr expr)(package private) voidwrite(JType type)(package private) voidwrite(Token state)(package private) voidwriteClass(java.lang.String nameToWrite)(package private) voidwriteEscaped(char item)(package private) voidwriteEscaped(java.lang.String item)(package private) voidwriteEscapedWord(java.lang.String rawText)(package private) voidwriteUnescaped(char item)(package private) voidwriteUnescaped(java.lang.String item)
-
-
-
Field Detail
-
format
private final FormatPreferences format
-
countingWriter
private final CountingWriter countingWriter
-
lineBuffer
private final java.lang.StringBuilder lineBuffer
-
lineSep
private final java.lang.String lineSep
-
thisTypeStack
private final java.util.ArrayDeque<AbstractJType> thisTypeStack
-
indentStack
private final java.util.ArrayList<Indent> indentStack
-
stackIterator
private final java.util.ListIterator<Indent> stackIterator
-
nextIndent
private final Indent nextIndent
-
state
private Token state
-
spaceState
private int spaceState
-
classFile
private ImplJSourceFile classFile
-
SS_NONE
private static final int SS_NONE
- See Also:
- Constant Field Values
-
SS_NEEDED
private static final int SS_NEEDED
- See Also:
- Constant Field Values
-
SS_ADDED
private static final int SS_ADDED
- See Also:
- Constant Field Values
-
SS_NEW_LINE
private static final int SS_NEW_LINE
- See Also:
- Constant Field Values
-
SS_2_NEW_LINE
private static final int SS_2_NEW_LINE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SourceFileWriter
SourceFileWriter(FormatPreferences format, java.io.Writer writer)
-
-
Method Detail
-
nl
void nl() throws java.io.IOException
- Throws:
java.io.IOException
-
sp
void sp() throws java.io.IOException
Force a space if one hasn't already been added.- Throws:
java.io.IOException- etc.
-
ntsp
void ntsp() throws java.io.IOException
A non-trailing space.- Throws:
java.io.IOException
-
getLine
int getLine()
-
getColumn
int getColumn()
-
processSpacing
void processSpacing() throws java.io.IOException- Throws:
java.io.IOException
-
addIndent
void addIndent() throws java.io.IOException- Throws:
java.io.IOException
-
writeEscaped
void writeEscaped(java.lang.String item) throws java.io.IOException- Throws:
java.io.IOException
-
writeEscaped
void writeEscaped(char item) throws java.io.IOException- Throws:
java.io.IOException
-
writeUnescaped
void writeUnescaped(java.lang.String item) throws java.io.IOException- Throws:
java.io.IOException
-
writeUnescaped
void writeUnescaped(char item) throws java.io.IOException- Throws:
java.io.IOException
-
write
void write(FormatPreferences.Space rule) throws java.io.IOException
- Throws:
java.io.IOException
-
writeClass
void writeClass(java.lang.String nameToWrite) throws java.io.IOException- Throws:
java.io.IOException
-
addWordSpace
void addWordSpace() throws java.io.IOException- Throws:
java.io.IOException
-
write
void write(Token state) throws java.io.IOException
- Throws:
java.io.IOException
-
writeEscapedWord
void writeEscapedWord(java.lang.String rawText) throws java.io.IOException- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException- Specified by:
flushin interfacejava.io.Flushable- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
write
void write(JType type) throws java.io.IOException
- Throws:
java.io.IOException
-
write
void write(AbstractJType type) throws java.io.IOException
- Throws:
java.io.IOException
-
write
void write(JExpr expr) throws java.io.IOException
- Throws:
java.io.IOException
-
write
void write(AbstractJExpr expr) throws java.io.IOException
- Throws:
java.io.IOException
-
pushIndent
void pushIndent(FormatPreferences.Indentation indentation)
-
pushIndent
void pushIndent(Indent indent)
-
popIndent
void popIndent(FormatPreferences.Indentation indentation)
-
popIndent
void popIndent(Indent indent)
-
getThisType
AbstractJType getThisType()
-
pushThisType
void pushThisType(AbstractJType thisType)
-
popThisType
void popThisType(AbstractJType thisType)
-
setClassFile
void setClassFile(ImplJSourceFile classFile)
-
getState
Token getState()
-
getClassFile
ImplJSourceFile getClassFile()
-
getFormat
FormatPreferences getFormat()
-
-