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 ImplJSourceFile
classFile
private CountingWriter
countingWriter
private FormatPreferences
format
private java.util.ArrayList<Indent>
indentStack
private java.lang.StringBuilder
lineBuffer
private java.lang.String
lineSep
private Indent
nextIndent
private int
spaceState
private static int
SS_2_NEW_LINE
private static int
SS_ADDED
private static int
SS_NEEDED
private static int
SS_NEW_LINE
private static int
SS_NONE
private java.util.ListIterator<Indent>
stackIterator
private Token
state
private 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) void
addIndent()
(package private) void
addWordSpace()
void
close()
void
flush()
(package private) ImplJSourceFile
getClassFile()
(package private) int
getColumn()
(package private) FormatPreferences
getFormat()
(package private) int
getLine()
(package private) Token
getState()
(package private) AbstractJType
getThisType()
(package private) void
nl()
(package private) void
ntsp()
A non-trailing space.(package private) void
popIndent(FormatPreferences.Indentation indentation)
(package private) void
popIndent(Indent indent)
(package private) void
popThisType(AbstractJType thisType)
(package private) void
processSpacing()
(package private) void
pushIndent(FormatPreferences.Indentation indentation)
(package private) void
pushIndent(Indent indent)
(package private) void
pushThisType(AbstractJType thisType)
(package private) void
setClassFile(ImplJSourceFile classFile)
(package private) void
sp()
Force a space if one hasn't already been added.(package private) void
write(AbstractJExpr expr)
(package private) void
write(AbstractJType type)
(package private) void
write(FormatPreferences.Space rule)
(package private) void
write(JExpr expr)
(package private) void
write(JType type)
(package private) void
write(Token state)
(package private) void
writeClass(java.lang.String nameToWrite)
(package private) void
writeEscaped(char item)
(package private) void
writeEscaped(java.lang.String item)
(package private) void
writeEscapedWord(java.lang.String rawText)
(package private) void
writeUnescaped(char item)
(package private) void
writeUnescaped(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:
flush
in interfacejava.io.Flushable
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in 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()
-
-