public class Base64Encoder
extends java.lang.Object
Base64Decoder
Modifier and Type | Field and Description |
---|---|
(package private) java.io.InputStream |
in |
(package private) java.io.OutputStream |
out |
(package private) boolean |
stringp |
static java.lang.String |
UTF8_CHARSET |
Constructor and Description |
---|
Base64Encoder(java.io.InputStream in,
java.io.OutputStream out)
Create a new Base64 encoder, encoding input to output.
|
Base64Encoder(java.lang.String input)
Create a new Base64 encoder, to encode the given string.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
encodeBase64Bytes(byte[] bytes)
Encode an array of bytes to a string with a default charset "UTF-8".
|
static java.lang.String |
encodeBase64Bytes(byte[] bytes,
java.lang.String charset)
Encode an array of bytes to a string with a charset.
|
static java.lang.String |
encodeBase64Object(java.lang.Object object)
Encode an object to a string with a default charset "UTF-8".
|
static java.lang.String |
encodeBase64Object(java.lang.Object object,
java.lang.String charset)
Encode an object to a string with a charset.
|
static void |
main(java.lang.String[] args)
Testing the encoder.
|
void |
process()
Process the data: encode the input stream to the output stream.
|
java.lang.String |
processString()
Encode the content of this encoder, as a string.
|
public static final java.lang.String UTF8_CHARSET
java.io.InputStream in
java.io.OutputStream out
boolean stringp
public Base64Encoder(java.lang.String input)
input
- The String to be encoded.public Base64Encoder(java.io.InputStream in, java.io.OutputStream out)
in
- The input stream to be encoded.out
- The output stream, to write encoded data to.public void process() throws java.io.IOException
java.io.IOException
- If we weren't able to access the input stream or
the output stream.public java.lang.String processString()
public static java.lang.String encodeBase64Bytes(byte[] bytes) throws java.lang.IllegalThreadStateException
bytes
- the bytes to be converted.java.lang.IllegalThreadStateException
public static java.lang.String encodeBase64Bytes(byte[] bytes, java.lang.String charset) throws java.lang.IllegalThreadStateException
bytes
- the bytes to be converted.charset
- the charset used to translate the bytes to stringjava.lang.IllegalThreadStateException
public static java.lang.String encodeBase64Object(java.lang.Object object) throws java.lang.IllegalThreadStateException
object
- the object to be encoded, must be Serializablejava.lang.IllegalThreadStateException
public static java.lang.String encodeBase64Object(java.lang.Object object, java.lang.String charset) throws java.lang.IllegalThreadStateException
object
- the object to be encoded, must be Serializablecharset
- the charset used to translate the object's bytes to stringjava.lang.IllegalThreadStateException
public static void main(java.lang.String[] args)
Copyright © SAS Institute. All Rights Reserved.