Package org.apache.james.mime4j.codec
Class Base64OutputStream
java.lang.Object
java.io.OutputStream
org.apache.james.mime4j.codec.Base64OutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
This class implements section 6.8. Base64 Content-Transfer-Encoding
from RFC 2045 Multipurpose Internet Mail Extensions (MIME) Part One:
Format of Internet Message Bodies by Freed and Borenstein.
Code is based on Base64 and Base64OutputStream code from Commons-Codec 1.4.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final byte[]
private static final byte[]
private static final int
private final OutputStream
-
Constructor Summary
ConstructorsConstructorDescriptionCreates aBase64OutputStream
that writes the encoded data to the given output stream using the default line length (76) and line separator (CRLF).Base64OutputStream
(OutputStream out, int lineLength) Creates aBase64OutputStream
that writes the encoded data to the given output stream using the given line length and the default line separator (CRLF).Base64OutputStream
(OutputStream out, int lineLength, byte[] lineSeparator) Creates aBase64OutputStream
that writes the encoded data to the given output stream using the given line length and line separator. -
Method Summary
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
DEFAULT_LINE_LENGTH
private static final int DEFAULT_LINE_LENGTH- See Also:
-
CRLF_SEPARATOR
private static final byte[] CRLF_SEPARATOR -
BASE64_TABLE
static final byte[] BASE64_TABLE -
delegate
-
-
Constructor Details
-
Base64OutputStream
Creates aBase64OutputStream
that writes the encoded data to the given output stream using the default line length (76) and line separator (CRLF).- Parameters:
out
- underlying output stream.
-
Base64OutputStream
Creates aBase64OutputStream
that writes the encoded data to the given output stream using the given line length and the default line separator (CRLF).The given line length will be rounded up to the nearest multiple of 4. If the line length is zero then the output will not be split into lines.
- Parameters:
out
- underlying output stream.lineLength
- desired line length.
-
Base64OutputStream
Creates aBase64OutputStream
that writes the encoded data to the given output stream using the given line length and line separator.The given line length will be rounded up to the nearest multiple of 4. If the line length is zero then the output will not be split into lines and the line separator is ignored.
The line separator must not include characters from the BASE64 alphabet (including the padding character
=
).- Parameters:
out
- underlying output stream.lineLength
- desired line length.lineSeparator
- line separator to use.
-
-
Method Details
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-