Package org.apache.xmlgraphics.util.io
Class Base64EncodeStream
java.lang.Object
java.io.OutputStream
org.apache.xmlgraphics.util.io.Base64EncodeStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
This class implements a Base64 Character encoder as specified in RFC1113.
Unlike some other encoding schemes there is nothing in this encoding
that indicates where a buffer starts or ends.
This means that the encoded text will simply start with the first line
of encoded text and end with the last line of encoded text.
- Version:
- $Id: Base64EncodeStream.java 1732018 2016-02-24 04:51:06Z gadams $ Originally authored by Thomas DeWeese, Vincent Hardy, and Chuck McManis.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) byte[]
(package private) int
(package private) boolean
(package private) byte[]
(package private) int
(package private) PrintStream
private static final byte[]
This array maps the 6 bit values to their characters -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
(package private) void
enocodeAtom - Take three bytes of input and encode it as 4 printable characters.(package private) void
encodeFromArray
(byte[] data, int offset, int len) enocodeAtom - Take three bytes of input and encode it as 4 printable characters.void
flush()
This can't really flush out output since that may generate '=' chars which would indicate the end of the stream.void
write
(byte[] data) void
write
(byte[] data, int off, int len) void
write
(int b) Methods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
PEM_ARRAY
private static final byte[] PEM_ARRAYThis array maps the 6 bit values to their characters -
atom
byte[] atom -
atomLen
int atomLen -
encodeBuf
byte[] encodeBuf -
lineLen
int lineLen -
out
PrintStream out -
closeOutOnClose
boolean closeOutOnClose
-
-
Constructor Details
-
Base64EncodeStream
-
Base64EncodeStream
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
flush
This can't really flush out output since that may generate '=' chars which would indicate the end of the stream. Instead we flush out. You can only be sure all output is writen by closing this stream.- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
encodeAtom
enocodeAtom - Take three bytes of input and encode it as 4 printable characters. Note that if the length in len is less than three is encodes either one or two '=' signs to indicate padding characters.- Throws:
IOException
-
encodeFromArray
enocodeAtom - Take three bytes of input and encode it as 4 printable characters. Note that if the length in len is less than three is encodes either one or two '=' signs to indicate padding characters.- Throws:
IOException
-