public class JavaWriter
extends java.io.Writer
| Constructor and Description |
|---|
JavaWriter(WriteStream os) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
java.lang.String |
errorMessage(java.lang.String message)
Returns the error message with proper line number.
|
static java.lang.String |
escapeJavaString(java.lang.String s)
Prints a Java escaped string
|
void |
flush() |
int |
generateId()
Generates a unique id.
|
void |
generateSmap()
Generates the smap file.
|
int |
getDestLine()
Returns the destination line.
|
LineMap |
getLineMap()
Gets the line map
|
WriteStream |
getWriteStream()
Returns the underlying stream.
|
void |
popDepth()
Pops an indentation depth.
|
void |
print(boolean b)
Prints a boolean.
|
void |
print(char ch)
Prints a character.
|
void |
print(int i)
Prints an integer.
|
void |
print(long l)
Prints an long
|
void |
print(java.lang.Object o)
Prints an object.
|
void |
print(java.lang.String s)
Prints a string
|
void |
printClass(java.lang.Class<?> cl)
Prints the Java represention of the class
|
void |
printIndent()
Prints the indentation at the beginning of a line.
|
void |
printJavaChar(char ch)
Prints a Java escaped string
|
void |
printJavaString(java.lang.String s)
Prints a Java escaped string
|
void |
printJavaTypeToObject(java.lang.String value,
java.lang.Class<?> javaType)
Converts a java primitive type to a Java object.
|
void |
printJavaTypeToObject(java.lang.String value,
JClass javaType)
Converts a java primitive type to a Java object.
|
void |
println()
Prints a newline
|
void |
println(boolean v)
Prints a boolean with a new line
|
void |
println(char ch)
Prints a character.
|
void |
println(int v)
Prints an integer with a new line
|
void |
println(long v)
Prints an long with a new line
|
void |
println(java.lang.Object v)
Prints an object with a new line
|
void |
println(java.lang.String s)
Prints a string with a new line
|
void |
printType(java.lang.reflect.Type type)
Prints the Java representation of the type
|
void |
printVarType(java.lang.reflect.TypeVariable<?> typeVariable) |
void |
pushDepth()
Pushes an indentation depth.
|
void |
setLineMap(LineMap lineMap)
Sets the line map
|
void |
setLocation(java.lang.String filename,
int line)
Sets the source filename and line.
|
void |
setPreferLast(boolean isPreferLast)
True if later source line numbers should override earlier ones
|
void |
write(char[] buffer,
int offset,
int length) |
public JavaWriter(WriteStream os)
public WriteStream getWriteStream()
public int getDestLine()
public void setLineMap(LineMap lineMap)
public LineMap getLineMap()
public void setLocation(java.lang.String filename,
int line)
throws java.io.IOException
filename - the filename of the source file.line - the line of the source file.java.io.IOExceptionpublic void setPreferLast(boolean isPreferLast)
public int generateId()
public void printJavaString(java.lang.String s)
throws java.io.IOException
java.io.IOExceptionpublic void printJavaChar(char ch)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String escapeJavaString(java.lang.String s)
public void pushDepth()
throws java.io.IOException
java.io.IOExceptionpublic void popDepth()
throws java.io.IOException
java.io.IOExceptionpublic void print(java.lang.String s)
throws java.io.IOException
java.io.IOExceptionpublic void write(char[] buffer,
int offset,
int length)
throws java.io.IOException
write in class java.io.Writerjava.io.IOExceptionpublic void print(char ch)
throws java.io.IOException
java.io.IOExceptionpublic void print(boolean b)
throws java.io.IOException
java.io.IOExceptionpublic void print(int i)
throws java.io.IOException
java.io.IOExceptionpublic void print(long l)
throws java.io.IOException
java.io.IOExceptionpublic void print(java.lang.Object o)
throws java.io.IOException
java.io.IOExceptionpublic void println(java.lang.String s)
throws java.io.IOException
java.io.IOExceptionpublic void println(boolean v)
throws java.io.IOException
java.io.IOExceptionpublic void println(char ch)
throws java.io.IOException
java.io.IOExceptionpublic void println(int v)
throws java.io.IOException
java.io.IOExceptionpublic void println(long v)
throws java.io.IOException
java.io.IOExceptionpublic void println(java.lang.Object v)
throws java.io.IOException
java.io.IOExceptionpublic void println()
throws java.io.IOException
java.io.IOExceptionpublic void printClass(java.lang.Class<?> cl)
throws java.io.IOException
java.io.IOExceptionpublic void printType(java.lang.reflect.Type type)
throws java.io.IOException
java.io.IOExceptionpublic void printVarType(java.lang.reflect.TypeVariable<?> typeVariable)
throws java.io.IOException
java.io.IOExceptionpublic void printJavaTypeToObject(java.lang.String value,
java.lang.Class<?> javaType)
throws java.io.IOException
value - the java expression to be convertedjavaType - the type of the converted expression.java.io.IOExceptionpublic void printJavaTypeToObject(java.lang.String value,
JClass javaType)
throws java.io.IOException
value - the java expression to be convertedjavaType - the type of the converted expression.java.io.IOExceptionpublic void printIndent()
throws java.io.IOException
java.io.IOExceptionpublic void generateSmap()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String errorMessage(java.lang.String message)
public void flush()
flush in interface java.io.Flushableflush in class java.io.Writerpublic void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.Writer