@NotThreadSafe public class Base64OutputStream extends WrappedOutputStream
Base64OutputStream will write data to another
OutputStream , given in the constructor, and encode/decode
to/from Base64 notation on the fly.Base64out| Constructor and Description |
|---|
Base64OutputStream(OutputStream aOS)
Constructs a
Base64OutputStream in ENCODE mode. |
Base64OutputStream(OutputStream aOS,
int nOptions)
Constructs a
Base64OutputStream in either ENCODE or DECODE mode. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Flushes and closes (I think, in the superclass) the stream.
|
void |
flushBase64()
Method added by PHIL.
|
void |
resumeEncoding()
Resumes encoding of the stream.
|
void |
setNewLineBytes(byte[] aNewLineBytes)
Set the newline bytes to be used, so that "\r\n" can be used instead of the
default "\n"
|
void |
suspendEncoding()
Suspends encoding of the stream.
|
void |
write(byte[] aBytes,
int nOfs,
int nLen)
Calls
write(int) repeatedly until len bytes are
written. |
void |
write(int theByte)
Writes the byte to the output stream after converting to/from Base64
notation.
|
getWrappedOutputStream, toStringflush, writepublic Base64OutputStream(@Nonnull OutputStream aOS)
Base64OutputStream in ENCODE mode.aOS - the OutputStream to which data will be written.public Base64OutputStream(@Nonnull OutputStream aOS, int nOptions)
Base64OutputStream in either ENCODE or DECODE mode.
Valid options:
ENCODE or DECODE: Encode or Decode as data is read.
DO_BREAK_LINES: don't break lines at 76 characters
(only meaningful when encoding)
Example: new Base64.OutputStream( out, Base64.ENCODE )
aOS - the OutputStream to which data will be written.nOptions - Specified options.Base64.ENCODE,
Base64.DECODE,
Base64.DO_BREAK_LINESpublic void setNewLineBytes(@Nonnull @Nonempty byte[] aNewLineBytes)
aNewLineBytes - The newline bytes to be used. May neither be null nor
empty.public void write(int theByte)
throws IOException
write in class FilterOutputStreamtheByte - the byte to writeIOExceptionpublic void write(@Nonnull byte[] aBytes, @Nonnegative int nOfs, @Nonnegative int nLen) throws IOException
write(int) repeatedly until len bytes are
written.write in class WrappedOutputStreamaBytes - array from which to read bytesnOfs - offset for arraynLen - max number of bytes to read into arrayIOExceptionpublic void flushBase64()
throws IOException
IOException - if there's an error.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class FilterOutputStreamIOExceptionpublic void suspendEncoding()
throws IOException
IOException - if there's an error flushingpublic void resumeEncoding()
Copyright © 2014–2020 Philip Helger. All rights reserved.