public class Base64
extends java.lang.Object
Constructor and Description |
---|
Base64() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
decode(java.io.InputStream in)
Decode Base64 input character stream into a String representation of
decoded binary stream.
|
void |
decode(java.io.InputStream in,
java.io.OutputStream out)
Decode Base64 input character stream into binary output stream.
|
static int |
decodedSize(byte[] data,
boolean newLines)
Compute the size of BASE64-decoded stream.
|
void |
encode(java.io.InputStream in,
java.io.OutputStream out)
Encode binary input stream into Base64 character stream
|
void |
encode(java.io.InputStream in,
java.io.OutputStream out,
boolean newLines)
Encode binary input stream into Base64 character stream
|
static int |
encodedSize(int length,
boolean newLines)
Compute the size of BASE64-encoded stream.
|
static void |
main(java.lang.String[] a)
Encodes a binary file into a BASE64 text file or vice versa
|
public void encode(java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException
in
- the InputStream
to encode.out
- the OutputStream
to which the encoded data is
written.java.io.IOException
- if an I/O error occurs while encoding.public void encode(java.io.InputStream in, java.io.OutputStream out, boolean newLines) throws java.io.IOException
in
- the InputStream
to encode.out
- the OutputStream
to which the encoded data is
written.newLines
- if true
(default) the encoded data is written in
max 76 character lines.java.io.IOException
- if an I/O error occurs while encoding.public void decode(java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException
in
- the InputStream
to decode.out
- the OutputStream
to write the decoded data to.java.io.IOException
- if an I/O error occurs while decoding.public java.lang.String decode(java.io.InputStream in) throws java.io.IOException
java.io.IOException
public static int encodedSize(int length, boolean newLines)
length
- the number of bytes to encodenewLines
- true if new-line characters will be added to encoded stream, false otherwiseencode(java.io.InputStream, java.io.OutputStream)
public static int decodedSize(byte[] data, boolean newLines)
data
- BASE64 encoded data produced by Base64.encode()newLines
- true if new-line characters have been added to the encoded stream, false otherwisedecode(java.io.InputStream, java.io.OutputStream)
public static void main(java.lang.String[] a) throws java.lang.Exception
java.lang.Exception