public class FoldedLineWriter extends Writer
| Constructor and Description |
|---|
FoldedLineWriter(Writer writer)
Creates a folded line writer.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the writer.
|
void |
flush()
Flushes the writer.
|
String |
getIndent()
Gets the string that is prepended to each folded line (defaults to a
single space character).
|
Integer |
getLineLength()
Gets the maximum length a line can be before it is folded (excluding the
newline, defaults to 75).
|
Writer |
getWriter()
Gets the wrapped
Writer object. |
void |
setIndent(String indent)
Sets the string that is prepended to each folded line (defaults to a
single space character).
|
void |
setLineLength(Integer lineLength)
Sets the maximum length a line can be before it is folded (excluding the
newline, defaults to 75).
|
void |
write(char[] cbuf,
int off,
int len)
Writes a portion of an array of characters.
|
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()
Writes a newline.
|
public FoldedLineWriter(Writer writer)
writer - the writer object to wrappublic void writeln() throws IOException
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 the string into
quoted-printableIOException - if there's a problem writing to the output streampublic void write(char[] cbuf, int off, int len) throws IOException
write in class Writercbuf - the array of charactersoff - the offset from which to start writing characterslen - the number of characters to writeIOException - if there's a problem writing to the output streampublic 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 the string into
quoted-printableIOException - if there's a problem writing to the output streampublic Integer getLineLength()
public void setLineLength(Integer lineLength)
lineLength - the line length or null to disable foldingIllegalArgumentException - if the line length is less than or equal
to zero, or the line length is less than the length of the indent stringpublic String getIndent()
public void setIndent(String indent)
indent - the indent string (cannot be empty, may only contain tabs
and spaces). Note that data streams using SyntaxStyle.NEW syntax
MUST use an indent string that contains EXACTLY ONE character.IllegalArgumentException - if the indent string is empty, or the
length of the indent string is greater than the max line length, or the
indent string contains illegal characterspublic void close() throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class WriterIOExceptionpublic void flush() throws IOException
flush in interface Flushableflush in class WriterIOExceptionCopyright © 2016–2018 Michael Angstadt. All rights reserved.