public class Base64OutputStream
extends java.io.FilterOutputStream
Code is based on Base64 and Base64OutputStream code from Commons-Codec 1.4.
| Modifier and Type | Field and Description |
|---|---|
private static java.util.Set<java.lang.Byte> |
BASE64_CHARS |
private static byte |
BASE64_PAD |
(package private) static byte[] |
BASE64_TABLE |
private boolean |
closed |
private static byte[] |
CRLF_SEPARATOR |
private int |
data |
private static int |
DEFAULT_LINE_LENGTH |
private byte[] |
encoded |
private static int |
ENCODED_BUFFER_SIZE |
private int |
lineLength |
private int |
linePosition |
private byte[] |
lineSeparator |
private static int |
MASK_6BITS |
private int |
modulus |
private int |
position |
private byte[] |
singleByte |
| Constructor and Description |
|---|
Base64OutputStream(java.io.OutputStream out)
Creates a
Base64OutputStream that writes the encoded data
to the given output stream using the default line length (76) and line
separator (CRLF). |
Base64OutputStream(java.io.OutputStream out,
int lineLength)
Creates a
Base64OutputStream that writes the encoded data
to the given output stream using the given line length and the default
line separator (CRLF). |
Base64OutputStream(java.io.OutputStream out,
int lineLength,
byte[] lineSeparator)
Creates a
Base64OutputStream that writes the encoded data
to the given output stream using the given line length and line
separator. |
| Modifier and Type | Method and Description |
|---|---|
private void |
checkLineSeparator(byte[] lineSeparator) |
void |
close() |
private void |
close0() |
void |
flush() |
private void |
flush0() |
void |
write(byte[] buffer) |
void |
write(byte[] buffer,
int offset,
int length) |
void |
write(int b) |
private void |
write0(byte[] buffer,
int from,
int to) |
private void |
writeLineSeparator() |
private void |
writePad() |
private static final int DEFAULT_LINE_LENGTH
private static final byte[] CRLF_SEPARATOR
static final byte[] BASE64_TABLE
private static final byte BASE64_PAD
private static final java.util.Set<java.lang.Byte> BASE64_CHARS
private static final int MASK_6BITS
private static final int ENCODED_BUFFER_SIZE
private final byte[] singleByte
private final int lineLength
private final byte[] lineSeparator
private boolean closed
private final byte[] encoded
private int position
private int data
private int modulus
private int linePosition
public Base64OutputStream(java.io.OutputStream out)
Base64OutputStream that writes the encoded data
to the given output stream using the default line length (76) and line
separator (CRLF).out - underlying output stream.public Base64OutputStream(java.io.OutputStream out,
int lineLength)
Base64OutputStream 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.
out - underlying output stream.lineLength - desired line length.public Base64OutputStream(java.io.OutputStream out,
int lineLength,
byte[] lineSeparator)
Base64OutputStream 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 =).
out - underlying output stream.lineLength - desired line length.lineSeparator - line separator to use.public final void write(int b)
throws java.io.IOException
write in class java.io.FilterOutputStreamjava.io.IOExceptionpublic final void write(byte[] buffer)
throws java.io.IOException
write in class java.io.FilterOutputStreamjava.io.IOExceptionpublic final void write(byte[] buffer,
int offset,
int length)
throws java.io.IOException
write in class java.io.FilterOutputStreamjava.io.IOExceptionpublic void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.FilterOutputStreamjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.FilterOutputStreamjava.io.IOExceptionprivate void write0(byte[] buffer,
int from,
int to)
throws java.io.IOException
java.io.IOExceptionprivate void flush0()
throws java.io.IOException
java.io.IOExceptionprivate void close0()
throws java.io.IOException
java.io.IOExceptionprivate void writePad()
throws java.io.IOException
java.io.IOExceptionprivate void writeLineSeparator()
throws java.io.IOException
java.io.IOExceptionprivate void checkLineSeparator(byte[] lineSeparator)