org.exolab.javasource

Class JSourceWriter

public final class JSourceWriter extends Writer

The writer used by the javasource classes.

Version: $Revision: 6324 $ $Date: 2005-03-30 03:29:24 -0700 (Wed, 30 Mar 2005) $

Author: Keith Visco

Field Summary
static charDEFAULT_CHAR
The default character to use for indentation.
static shortDEFAULT_SIZE
The default indentation size.
Constructor Summary
JSourceWriter(Writer out)
Creates a new JSourceWriter.
JSourceWriter(Writer out, boolean autoflush)
Creates a new JSourceWriter.
JSourceWriter(Writer out, short tabSize, boolean autoflush)
Creates a new JSourceWriter.
JSourceWriter(Writer out, short tabSize, char tabChar, boolean autoflush)
Creates a new JSourceWriter.
Method Summary
voidclose()
voidflush()
protected chargetIndentChar()
Returns the current character used for indentation.
protected shortgetIndentLevel()
Returns the current indentation level.
protected shortgetIndentSize()
Returns the current indent size (getIndentLevel()*tabSize).
StringgetLineSeparator()
Returns the line separator being used by this JSourceWriter.
voidindent()
Increases the indentation level by 1.
booleanisNewline()
Checks to see if the cursor is positioned on a new line.
voidsetLineSeparator(String lineSeparator)
Sets the line separator to use at the end of each line.
voidunindent()
Decreases the indentation level by 1.
voidwrite(float f)
voidwrite(long l)
voidwrite(double d)
voidwrite(Object obj)
voidwrite(boolean b)
voidwrite(String s, int off, int len)
voidwrite(String s)
voidwrite(char[] buf)
voidwrite(int c)
voidwrite(char[] buf, int off, int len)
protected voidwriteIndent()
Always applies the current indentation.
voidwriteln()
voidwriteln(float f)
voidwriteln(long l)
voidwriteln(int i)
voidwriteln(double d)
voidwriteln(Object obj)
voidwriteln(String string)
voidwriteln(char[] chars)
voidwriteln(boolean b)
voidwriteln(char c)

Field Detail

DEFAULT_CHAR

public static final char DEFAULT_CHAR
The default character to use for indentation.

DEFAULT_SIZE

public static final short DEFAULT_SIZE
The default indentation size.

Constructor Detail

JSourceWriter

public JSourceWriter(Writer out)
Creates a new JSourceWriter.

Parameters: out the Writer to write the actual output to

JSourceWriter

public JSourceWriter(Writer out, boolean autoflush)
Creates a new JSourceWriter.

Parameters: 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

JSourceWriter

public JSourceWriter(Writer out, short tabSize, boolean autoflush)
Creates a new JSourceWriter.

Parameters: 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

JSourceWriter

public JSourceWriter(Writer out, short tabSize, char tabChar, boolean autoflush)
Creates a new JSourceWriter.

Parameters: 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

Method Detail

close

public void close()

flush

public void flush()

getIndentChar

protected char getIndentChar()
Returns the current character used for indentation.

Returns: the current character used for indentation.

getIndentLevel

protected short getIndentLevel()
Returns the current indentation level.

Returns: the current indentation level.

getIndentSize

protected short getIndentSize()
Returns the current indent size (getIndentLevel()*tabSize).

Returns: the current indent size

getLineSeparator

public String getLineSeparator()
Returns the line separator being used by this JSourceWriter.

Returns: the line separator being used by this JSourceWriter.

indent

public void indent()
Increases the indentation level by 1.

isNewline

public boolean isNewline()
Checks to see if the cursor is positioned on a new line.

Returns: true if the cursor is at the start of a new line, otherwise false

setLineSeparator

public void setLineSeparator(String lineSeparator)
Sets the line separator to use at the end of each line. Typically a line separator will be one of the following:

Parameters: lineSeparator the String to use as a line separator.

unindent

public void unindent()
Decreases the indentation level by 1.

write

public void write(float f)

write

public void write(long l)

write

public void write(double d)

write

public void write(Object obj)

write

public void write(boolean b)

write

public void write(String s, int off, int len)

write

public void write(String s)

write

public void write(char[] buf)

write

public void write(int c)

write

public void write(char[] buf, int off, int len)

writeIndent

protected void writeIndent()
Always applies the current indentation.

writeln

public void writeln()

writeln

public void writeln(float f)

writeln

public void writeln(long l)

writeln

public void writeln(int i)

writeln

public void writeln(double d)

writeln

public void writeln(Object obj)

writeln

public void writeln(String string)

writeln

public void writeln(char[] chars)

writeln

public void writeln(boolean b)

writeln

public void writeln(char c)
Intalio Inc. (C) 1999-2006. All rights reserved http://www.intalio.com