|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.Writer
biweekly.io.text.FoldedLineWriter
public class FoldedLineWriter
Automatically folds lines as they are written.
Field Summary |
---|
Fields inherited from class java.io.Writer |
---|
lock |
Constructor Summary | |
---|---|
FoldedLineWriter(Writer writer,
int lineLength,
String indent,
String newline)
|
Method Summary | |
---|---|
void |
close()
|
void |
flush()
|
String |
getIndent()
Gets the string that is prepended to each folded line. |
int |
getLineLength()
Gets the maximum length a line can be before it is folded (excluding the newline). |
String |
getNewline()
Gets the newline sequence that is used to separate lines. |
void |
setIndent(String indent)
Sets the string that is prepended to each folded line. |
void |
setLineLength(int lineLength)
Sets the maximum length a line can be before it is folded (excluding the newline). |
void |
setNewline(String newline)
Sets the newline sequence that is used to separate lines |
void |
write(char[] buf,
int start,
int end)
|
void |
write(char[] buf,
int start,
int end,
int lineLength,
String indent)
Writes a portion of an array of characters. |
void |
writeln(String str)
Writes a string of text, followed by a newline. |
Methods inherited from class java.io.Writer |
---|
append, append, append, write, write, write, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FoldedLineWriter(Writer writer, int lineLength, String indent, String newline)
writer
- the writer object to wraplineLength
- the maximum length a line can be before it is folded
(excluding the newline)indent
- the string to prepend to each folded line (e.g. a single
space character)newline
- the newline sequence to use (e.g. "\r\n")
IllegalArgumentException
- if the line length is less than or equal
to zero
IllegalArgumentException
- if the length of the indent string is
greater than the max line lengthMethod Detail |
---|
public void writeln(String str) throws IOException
str
- the text to write
IOException
- if there's a problem writing to the output streampublic void write(char[] buf, int start, int end) throws IOException
write
in class Writer
IOException
public void write(char[] buf, int start, int end, int lineLength, String indent) throws IOException
buf
- the array of charactersstart
- the offset from which to start writing charactersend
- the number of characters to writelineLength
- the maximum length a line can be before it is folded
(excluding the newline)indent
- the indent string to use (e.g. a single space character)
IOException
- if there's a problem writing to the output streampublic void close() throws IOException
close
in interface Closeable
close
in class Writer
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class Writer
IOException
public int getLineLength()
public void setLineLength(int lineLength)
lineLength
- the line length
IllegalArgumentException
- if the line length is less than or equal
to zeropublic String getIndent()
public void setIndent(String indent)
indent
- the indent string (e.g. a single space character)
IllegalArgumentException
- if the length of the indent string is
greater than the max line lengthpublic String getNewline()
public void setNewline(String newline)
newline
- the newline sequence
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |