class SourceFileWriter
extends java.lang.Object
implements java.io.Flushable, java.io.Closeable
Modifier and Type | Field and 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_ADDED |
private static int |
SS_NEEDED |
private static int |
SS_NEEDS_INDENT |
private static int |
SS_NONE |
private java.util.ListIterator<Indent> |
stackIterator |
private Token |
state |
private java.util.ArrayDeque<AbstractJType> |
thisTypeStack |
Constructor and Description |
---|
SourceFileWriter(FormatPreferences format,
java.io.Writer writer) |
Modifier and Type | Method and 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) |
private final FormatPreferences format
private final CountingWriter countingWriter
private final java.lang.StringBuilder lineBuffer
private final java.lang.String lineSep
private final java.util.ArrayDeque<AbstractJType> thisTypeStack
private final java.util.ArrayList<Indent> indentStack
private final java.util.ListIterator<Indent> stackIterator
private final Indent nextIndent
private Token state
private int spaceState
private ImplJSourceFile classFile
private static final int SS_NONE
private static final int SS_NEEDED
private static final int SS_ADDED
private static final int SS_NEEDS_INDENT
SourceFileWriter(FormatPreferences format, java.io.Writer writer)
void nl() throws java.io.IOException
java.io.IOException
void sp() throws java.io.IOException
java.io.IOException
- etc.void ntsp() throws java.io.IOException
java.io.IOException
int getLine()
int getColumn()
void processSpacing() throws java.io.IOException
java.io.IOException
void addIndent() throws java.io.IOException
java.io.IOException
void writeEscaped(java.lang.String item) throws java.io.IOException
java.io.IOException
void writeEscaped(char item) throws java.io.IOException
java.io.IOException
void writeUnescaped(java.lang.String item) throws java.io.IOException
java.io.IOException
void writeUnescaped(char item) throws java.io.IOException
java.io.IOException
void write(FormatPreferences.Space rule) throws java.io.IOException
java.io.IOException
void writeClass(java.lang.String nameToWrite) throws java.io.IOException
java.io.IOException
void addWordSpace() throws java.io.IOException
java.io.IOException
void write(Token state) throws java.io.IOException
java.io.IOException
void writeEscapedWord(java.lang.String rawText) throws java.io.IOException
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
void write(JType type) throws java.io.IOException
java.io.IOException
void write(AbstractJType type) throws java.io.IOException
java.io.IOException
void write(JExpr expr) throws java.io.IOException
java.io.IOException
void write(AbstractJExpr expr) throws java.io.IOException
java.io.IOException
void pushIndent(FormatPreferences.Indentation indentation)
void pushIndent(Indent indent)
void popIndent(FormatPreferences.Indentation indentation)
void popIndent(Indent indent)
AbstractJType getThisType()
void pushThisType(AbstractJType thisType)
void popThisType(AbstractJType thisType)
void setClassFile(ImplJSourceFile classFile)
Token getState()
ImplJSourceFile getClassFile()
FormatPreferences getFormat()