|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectWriter
FilterWriter
IndentedLineWriter
@ThreadSafe @Decorator(value=java.io.Writer.class) public class IndentedLineWriter
A writer that put some spaces in front of every lines. The indentation is initially set
to 0 spaces. Users must invoke setIndentation(int) or setMargin(String)
in order to set a different value.
| utility/geotk-utility (download) | View source code for this class |
| Field Summary |
|---|
| Fields inherited from class FilterWriter |
|---|
out |
| Fields inherited from class Writer |
|---|
lock |
| Constructor Summary | |
|---|---|
IndentedLineWriter(Writer out)
Constructs a stream which will add spaces in front of each line. |
|
IndentedLineWriter(Writer out,
int width)
Constructs a stream which will the given amount of spaces in front of each line. |
|
| Method Summary | |
|---|---|
protected void |
beginNewLine()
Invoked when a new line is beginning. |
int |
getIdentation()
Returns the current indentation. |
String |
getMargin()
Returns the margin which is written at the beginning of every line. |
void |
setIndentation(int width)
Sets the indentation to the specified value. |
void |
setMargin(String margin)
Sets the margin to be written at the beginning of every line. |
String |
toString()
Returns a string representation if this writer. |
void |
write(char[] buffer,
int offset,
int length)
Writes a portion of an array of characters. |
void |
write(int c)
Writes a single character. |
void |
write(String string,
int offset,
int length)
Writes a portion of a string. |
| Methods inherited from class FilterWriter |
|---|
close, flush |
| Methods inherited from class Writer |
|---|
append, append, append, write, write |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public IndentedLineWriter(Writer out)
setIndentation(int) or setMargin(String)
method must be invoked after this constructor in order to specify
the amount of spaces to add.
out - The underlying stream to write to.
public IndentedLineWriter(Writer out,
int width)
setIndentation(int) right after the
construction.
out - The underlying stream to write to.width - The indentation.| Method Detail |
|---|
public int getIdentation()
setIndentation(int) method, or the length of the string given to the
setMargin(String) method.
public void setIndentation(int width)
width - The number of space to insert at the beginning of every line.public String getMargin()
setMargin(String), or implicitly by a call to setIndentation(int).
public void setMargin(String margin)
margin - The string to be inserted at the beginning of every lines.
protected void beginNewLine()
throws IOException
setIndentation(int).
IOException - If an I/O error occurs
public void write(int c)
throws IOException
write in class FilterWriterIOException - If an I/O error occurs.
public void write(char[] buffer,
int offset,
int length)
throws IOException
write in class FilterWriterbuffer - Buffer of characters to be written.offset - Offset from which to start reading characters.length - Number of characters to be written.
IOException - If an I/O error occurs.
public void write(String string,
int offset,
int length)
throws IOException
write in class FilterWriterstring - String to be written.offset - Offset from which to start reading characters.length - Number of characters to be written.
IOException - If an I/O error occurs.public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||