|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.Writer
ezvcard.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,
Integer lineLength,
String indent,
String newline)
Creates a folded line writer. |
Method Summary | |
---|---|
FoldedLineWriter |
append(CharSequence str,
boolean quotedPrintable,
Charset charset)
Writes a string. |
void |
close()
Closes the writer. |
void |
flush()
Flushes the writer. |
Charset |
getEncoding()
Gets the writer's character encoding. |
String |
getIndent()
Gets the string that is prepended to each folded line. |
Integer |
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. |
Writer |
getWriter()
Gets the wrapped Writer object. |
void |
setIndent(String indent)
Sets the string that is prepended to each folded line. |
void |
setLineLength(Integer 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[] cbuf,
int off,
int len)
|
void |
write(char[] cbuf,
int off,
int len,
boolean quotedPrintable,
Charset charset)
Writes a portion of an array of characters. |
void |
write(CharSequence str,
boolean quotedPrintable,
Charset charset)
Writes a string. |
void |
writeln(String str)
Writes a string, 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, Integer 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), or null disable foldingindent
- 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 FoldedLineWriter append(CharSequence str, boolean quotedPrintable, Charset charset) throws IOException
str
- the string to writequotedPrintable
- true to encode the string in quoted-printable
encoding, false not tocharset
- the character set to use when encoding into
quoted-printable, or null to use the writer's character encoding (only
applicable if "quotedPrintable" is set to true)
IOException
- if there's a problem writing to the output streampublic void write(CharSequence str, boolean quotedPrintable, Charset charset) throws IOException
str
- the string to writequotedPrintable
- true to encode the string in quoted-printable
encoding, false not tocharset
- the character set to use when encoding into
quoted-printable, or null to use the writer's character encoding (only
applicable if "quotedPrintable" is set to true)
IOException
- if there's a problem writing to the output streampublic void write(char[] cbuf, int off, int len) throws IOException
write
in class Writer
IOException
public void write(char[] cbuf, int off, int len, boolean quotedPrintable, Charset charset) throws IOException
cbuf
- the array of charactersoff
- the offset from which to start writing characterslen
- the number of characters to writequotedPrintable
- true to encode the string in quoted-printable
encoding, false not tocharset
- the character set to use when encoding into
quoted-printable, or null to use the writer's character encoding (only
applicable if "quotedPrintable" is set to true)
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 Integer getLineLength()
public void setLineLength(Integer lineLength)
lineLength
- the line length or null to disable folding
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 sequencepublic Writer getWriter()
Writer
object.
public Charset getEncoding()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |