|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectWriter
FilterWriter
LineWrapWriter
@ThreadSafe @Decorator(value=java.io.Writer.class) public class LineWrapWriter
Wraps the lines at the specified maximal line length. The default line
length is 80 characters. The maximal line length can be changed by a call
to setMaximalLineLength(int).
| utility/geotk-utility (download) | View source code for this class |
| Field Summary | |
|---|---|
static char |
HYPHEN
Hyphen character. |
static char |
SOFT_HYPHEN
Hyphen character to be visible only if there is a line break to insert after it. |
| Fields inherited from class FilterWriter |
|---|
out |
| Fields inherited from class Writer |
|---|
lock |
| Constructor Summary | |
|---|---|
LineWrapWriter(Writer out)
Constructs a stream which will wraps the lines at 80 characters. |
|
LineWrapWriter(Writer out,
int length)
Constructs a stream which will wraps the lines at the given maximal amount of characters. |
|
| Method Summary | |
|---|---|
void |
close()
Sends pending characters to the underlying stream and close it. |
void |
flush()
Sends pending characters to the underlying stream. |
int |
getMaximalLineLength()
Returns the maximal line length. |
void |
setMaximalLineLength(int length)
Sets the maximal line length. |
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 Writer |
|---|
append, append, append, write, write |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final char HYPHEN
'-' character.
For non-breaking hyphen, use the '‑' character.
public static final char SOFT_HYPHEN
HYPHEN character.
This is equivalent to the HTML ­ entity.
| Constructor Detail |
|---|
public LineWrapWriter(Writer out)
setMaximalLineLength(int).
out - The underlying stream to write to.
public LineWrapWriter(Writer out,
int length)
setMaximalLineLength(int)
immediately after construction.
out - The underlying stream to write to.length - The maximal line length.| Method Detail |
|---|
public int getMaximalLineLength()
public void setMaximalLineLength(int length)
length - The new maximal line length.
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 void flush()
throws IOException
LineWrapWriter to properly wrap the current line if it is in
the middle of a word.
Invoking this method also flush the underlying stream. A cheapier
way to send pending characters is to make sure that the last character is a
line terminator ('\r' or '\n').
flush in interface Flushableflush in class FilterWriterIOException - If an I/O error occurs.
public void close()
throws IOException
close in interface Closeableclose in class FilterWriterIOException - 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 | |||||||||