public class Base64OutputStream extends FilterOutputStream
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 pout)
Constructs a
Base64OutputStream in ENCODE mode. |
Base64OutputStream(OutputStream pout,
int poptions)
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 |
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.
|
flush, writepublic Base64OutputStream(@Nonnull OutputStream pout)
Base64OutputStream in ENCODE mode.pout - the OutputStream to which data will be written.public Base64OutputStream(@Nonnull OutputStream pout, int poptions)
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 )
pout - the OutputStream to which data will be written.poptions - Specified options.Base64.ENCODE,
Base64.DECODE,
Base64.DO_BREAK_LINESpublic 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 FilterOutputStreamaBytes - 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–2016 Philip Helger. All rights reserved.