Top Description Fields Constructors Methods
org.HdrHistogram

pack-priv Class Base64Helper

extends Object
Class Inheritance
Imports
java.lang.reflect.Method

Base64Helper exists to bridge inconsistencies in Java SE support of Base64 encoding and decoding. Earlier Java SE platforms (up to and including Java SE 8) supported base64 encode/decode via the javax.xml.bind.DatatypeConverter class, which was deprecated and eventually removed in Java SE 9. Later Java SE platforms (Java SE 8 and later) support base64 encode/decode via the java.util.Base64 class (first introduced in Java SE 8, and not available on e.g. Java SE 6 or 7). This makes it "hard" to write a single piece of source code that deals with base64 encodings and will compile and run on e.g. Java SE 7 AND Java SE 9. And such common source is a common need for libraries. This class is intended to encapsulate this "hard"-ness and hide the ugly pretzle-twising needed under the covers. Base64Helper provides a common API that works across Java SE 6..9 (and beyond hopefully), and uses late binding (Reflection) internally to avoid javac-compile-time dependencies on a specific Java SE version (e.g. beyond 7 or before 9).

Field Summary

Modifier and TypeField and Description
private static Method
private static Object
private static Method
private static Object

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static byte[]

Returns:

a byte array containing the binary representation equivalent of the Base64 encoded input
parseBase64Binary
(String
A base64-encoded input String
base64input
)

Converts a Base64 encoded String to a byte array

pack-priv static String

Returns:

a String containing the Base64 encoded equivalent of the binary input
printBase64Binary
(byte[]
A binary encoded input array
binaryArray
)

Converts an array of bytes into a Base64 string.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

decodeMethodback to summary
private static Method decodeMethod
decoderObjback to summary
private static Object decoderObj
encodeMethodback to summary
private static Method encodeMethod
encoderObjback to summary
private static Object encoderObj

Constructor Detail

Base64Helperback to summary
pack-priv Base64Helper()

Method Detail

parseBase64Binaryback to summary
pack-priv static byte[] parseBase64Binary(String base64input)

Converts a Base64 encoded String to a byte array

Parameters
base64input:String

A base64-encoded input String

Returns:byte[]

a byte array containing the binary representation equivalent of the Base64 encoded input

printBase64Binaryback to summary
pack-priv static String printBase64Binary(byte[] binaryArray)

Converts an array of bytes into a Base64 string.

Parameters
binaryArray:byte[]

A binary encoded input array

Returns:String

a String containing the Base64 encoded equivalent of the binary input