public class FoldedLineWriter extends Writer
Constructor and Description |
---|
FoldedLineWriter(Writer writer)
Creates a folded line writer.
|
Modifier and Type | Method and Description |
---|---|
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 (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).
|
String |
getNewline()
Gets the newline sequence that is used to separate lines (defaults to
CRLF).
|
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 |
setNewline(String newline)
Sets the newline sequence that is used to separate lines (defaults to
CRLF).
|
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.
|
public FoldedLineWriter(Writer writer)
writer
- the writer object to wrappublic void writeln(String str) throws IOException
str
- the text to writeIOException
- 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 interface AutoCloseable
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 foldingIllegalArgumentException
- if the line length is less than or equal
to zeropublic String getIndent()
public void setIndent(String indent)
indent
- the indent stringIllegalArgumentException
- 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 Charset getEncoding()
This software is published under the BSD license. Copyright © 2003-${build.year}, CRIXP AG, Switzerland, All rights reserved. Use is subject to license terms.