java.io.Closeable
, java.io.Flushable
, java.lang.Appendable
, java.lang.AutoCloseable
public final class JSourceWriter
extends java.io.Writer
Modifier and Type | Field | Description |
---|---|---|
static char |
DEFAULT_CHAR |
The default character to use for indentation.
|
static short |
DEFAULT_SIZE |
The default indentation size.
|
Constructor | Description |
---|---|
JSourceWriter(java.io.Writer out) |
Creates a new JSourceWriter.
|
JSourceWriter(java.io.Writer out,
boolean autoflush) |
Creates a new JSourceWriter.
|
JSourceWriter(java.io.Writer out,
short tabSize,
boolean autoflush) |
Creates a new JSourceWriter.
|
JSourceWriter(java.io.Writer out,
short tabSize,
char tabChar,
boolean autoflush) |
Creates a new JSourceWriter.
|
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
|
void |
flush() |
|
protected char |
getIndentChar() |
Returns the current character used for indentation.
|
protected short |
getIndentLevel() |
Returns the current indentation level.
|
protected short |
getIndentSize() |
Returns the current indent size (getIndentLevel()*tabSize).
|
java.lang.String |
getLineSeparator() |
Returns the line separator being used by this JSourceWriter.
|
void |
indent() |
Increases the indentation level by 1.
|
boolean |
isNewline() |
Checks to see if the cursor is positioned on a new line.
|
void |
setLineSeparator(java.lang.String lineSeparator) |
Sets the line separator to use at the end of each line.
|
void |
unindent() |
Decreases the indentation level by 1.
|
void |
write(boolean b) |
|
void |
write(char[] buf) |
|
void |
write(char[] buf,
int off,
int len) |
|
void |
write(double d) |
|
void |
write(float f) |
|
void |
write(int c) |
|
void |
write(long l) |
|
void |
write(java.lang.Object obj) |
|
void |
write(java.lang.String s) |
|
void |
write(java.lang.String s,
int off,
int len) |
|
protected void |
writeIndent() |
Always applies the current indentation.
|
void |
writeln() |
|
void |
writeln(boolean b) |
|
void |
writeln(char c) |
|
void |
writeln(char[] chars) |
|
void |
writeln(double d) |
|
void |
writeln(float f) |
|
void |
writeln(int i) |
|
void |
writeln(long l) |
|
void |
writeln(java.lang.Object obj) |
|
void |
writeln(java.lang.String string) |
public static final char DEFAULT_CHAR
public static final short DEFAULT_SIZE
public JSourceWriter(java.io.Writer out)
out
- The Writer to write the actual output to.public JSourceWriter(java.io.Writer out, boolean autoflush)
out
- The Writer to write the actual output to.autoflush
- A boolean indicating whether or not to perform automatic
flush at the end of a line.public JSourceWriter(java.io.Writer out, short tabSize, boolean autoflush)
out
- The Writer to write the actual output to.tabSize
- The size of each indentation.autoflush
- A boolean indicating whether or not to perform automatic
flush at the end of a line.public JSourceWriter(java.io.Writer out, short tabSize, char tabChar, boolean autoflush)
out
- The Writer to write the actual output to.tabSize
- The size of each indentation.tabChar
- The character to use for indentation.autoflush
- A boolean indicating whether or not to perform an automatic
flush at the end of each line.public java.lang.String getLineSeparator()
public void indent()
public boolean isNewline()
public void setLineSeparator(java.lang.String lineSeparator)
lineSeparator
- The String to use as a line separator.public void unindent()
protected short getIndentLevel()
protected short getIndentSize()
protected char getIndentChar()
protected void writeIndent()
public void write(float f)
public void write(long l)
public void write(double d)
public void write(java.lang.Object obj)
public void write(boolean b)
public void writeln()
public void writeln(float f)
public void writeln(long l)
public void writeln(int i)
public void writeln(double d)
public void writeln(java.lang.Object obj)
public void writeln(java.lang.String string)
public void writeln(char[] chars)
public void writeln(boolean b)
public void writeln(char c)
public void close()
close
in interface java.lang.AutoCloseable
close
in interface java.io.Closeable
close
in class java.io.Writer
public void flush()
flush
in interface java.io.Flushable
flush
in class java.io.Writer
public void write(java.lang.String s, int off, int len)
write
in class java.io.Writer
public void write(java.lang.String s)
write
in class java.io.Writer
public void write(char[] buf)
write
in class java.io.Writer
public void write(int c)
write
in class java.io.Writer
public void write(char[] buf, int off, int len)
write
in class java.io.Writer
Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com