public class FoldedLineWriter
extends java.io.Writer
Constructor and Description |
---|
FoldedLineWriter(java.io.Writer writer)
Creates a folded line writer.
|
Modifier and Type | Method and Description |
---|---|
FoldedLineWriter |
append(java.lang.CharSequence str,
boolean quotedPrintable,
java.nio.charset.Charset charset)
Writes a string.
|
void |
close()
Closes the writer.
|
void |
flush()
Flushes the writer.
|
java.nio.charset.Charset |
getEncoding()
Gets the writer's character encoding.
|
java.lang.String |
getIndent()
Gets the string that is prepended to each folded line (defaults to a
single space character).
|
java.lang.Integer |
getLineLength()
Gets the maximum length a line can be before it is folded (excluding the
newline, defaults to 75).
|
java.lang.String |
getNewline()
Gets the newline sequence that is used to separate lines (defaults to
CRLF).
|
java.io.Writer |
getWriter()
Gets the wrapped
Writer object. |
void |
setIndent(java.lang.String indent)
Sets the string that is prepended to each folded line (defaults to a
single space character).
|
void |
setLineLength(java.lang.Integer lineLength)
Sets the maximum length a line can be before it is folded (excluding the
newline, defaults to 75).
|
void |
setNewline(java.lang.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,
java.nio.charset.Charset charset)
Writes a portion of an array of characters.
|
void |
write(java.lang.CharSequence str,
boolean quotedPrintable,
java.nio.charset.Charset charset)
Writes a string.
|
void |
writeln(java.lang.String str)
Writes a string, followed by a newline.
|
public FoldedLineWriter(java.io.Writer writer)
writer
- the writer object to wrappublic void writeln(java.lang.String str) throws java.io.IOException
str
- the text to writejava.io.IOException
- if there's a problem writing to the output streampublic FoldedLineWriter append(java.lang.CharSequence str, boolean quotedPrintable, java.nio.charset.Charset charset) throws java.io.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)java.io.IOException
- if there's a problem writing to the output streampublic void write(java.lang.CharSequence str, boolean quotedPrintable, java.nio.charset.Charset charset) throws java.io.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)java.io.IOException
- if there's a problem writing to the output streampublic void write(char[] cbuf, int off, int len) throws java.io.IOException
write
in class java.io.Writer
java.io.IOException
public void write(char[] cbuf, int off, int len, boolean quotedPrintable, java.nio.charset.Charset charset) throws java.io.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)java.io.IOException
- if there's a problem writing to the output streampublic void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.Writer
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.Writer
java.io.IOException
public java.lang.Integer getLineLength()
public void setLineLength(java.lang.Integer lineLength)
lineLength
- the line length or null to disable foldingjava.lang.IllegalArgumentException
- if the line length is less than or equal
to zeropublic java.lang.String getIndent()
public void setIndent(java.lang.String indent)
indent
- the indent stringjava.lang.IllegalArgumentException
- if the length of the indent string is
greater than the max line lengthpublic java.lang.String getNewline()
public void setNewline(java.lang.String newline)
newline
- the newline sequencepublic java.io.Writer getWriter()
Writer
object.public java.nio.charset.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.