Package org.apache.vinci.transport.util
Class Base64Converter
java.lang.Object
org.apache.vinci.transport.util.Base64Converter
Provides utility methods for Binary <=> Base64 conversion.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final byte[]
static final int
If you ask for line-breaks, this is the maximum line length used. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Utility class not meant to be instantiated. -
Method Summary
Modifier and TypeMethodDescriptionprivate static byte
b64codes
(int which) private static int
b64decodeDigit
(int c) private static int
b64decodeOctet
(byte[] in, int in_offset, byte[] out, int out_offset, int max_offset) private static void
b64encodeOctet
(byte[] to, int to_offset, byte[] from, int from_offset, int count) private static boolean
b64validDigit
(byte a) static int
calculateBase64OutputSize
(int input_size, boolean line_breaks) Calculates the size of the resulting Base64 string returned by this class for a binary byte array of the specified length.static int
calculateBinaryOutputSize
(byte[] input, int input_size) Calculate the number of bytes encoded by a given Base64 input.private static int
consumeInvalidDigits
(byte[] in, int off, int max_offset) static String
convertBase64StringToString
(String base64) static byte[]
convertBase64ToBinary
(byte[] input) static byte[]
convertBase64ToBinary
(byte[] input, int input_size) static byte[]
convertBinaryToBase64
(byte[] from) static byte[]
convertBinaryToBase64
(byte[] from, int count, boolean line_breaks) static String
convertStringToBase64String
(String convert_me)
-
Field Details
-
LINE_LENGTH
public static final int LINE_LENGTHIf you ask for line-breaks, this is the maximum line length used.- See Also:
-
B64_CODE
private static final byte[] B64_CODE
-
-
Constructor Details
-
Base64Converter
private Base64Converter()Utility class not meant to be instantiated.
-
-
Method Details
-
convertBinaryToBase64
public static byte[] convertBinaryToBase64(byte[] from) - Parameters:
from
- -- Returns:
- -
-
convertStringToBase64String
- Parameters:
convert_me
- -- Returns:
- -
-
convertBase64StringToString
- Parameters:
base64
- -- Returns:
- -
- Throws:
Base64FormatException
- -
-
convertBinaryToBase64
public static byte[] convertBinaryToBase64(byte[] from, int count, boolean line_breaks) - Parameters:
from
- -count
- -line_breaks
- -- Returns:
- -
-
calculateBase64OutputSize
public static int calculateBase64OutputSize(int input_size, boolean line_breaks) Calculates the size of the resulting Base64 string returned by this class for a binary byte array of the specified length. Includes carriage returns and all.- Parameters:
input_size
- -line_breaks
- -- Returns:
- -
-
convertBase64ToBinary
- Parameters:
input
- -- Returns:
- -
- Throws:
Base64FormatException
- -
-
convertBase64ToBinary
public static byte[] convertBase64ToBinary(byte[] input, int input_size) throws Base64FormatException - Parameters:
input
- -input_size
- -- Returns:
- -
- Throws:
Base64FormatException
- -
-
calculateBinaryOutputSize
public static int calculateBinaryOutputSize(byte[] input, int input_size) throws Base64FormatException Calculate the number of bytes encoded by a given Base64 input.- Parameters:
input
- -input_size
- -- Returns:
- -
- Throws:
Base64FormatException
- -
-
consumeInvalidDigits
private static int consumeInvalidDigits(byte[] in, int off, int max_offset) throws Base64FormatException - Throws:
Base64FormatException
-
b64decodeOctet
private static int b64decodeOctet(byte[] in, int in_offset, byte[] out, int out_offset, int max_offset) throws Base64FormatException - Throws:
Base64FormatException
-
b64decodeDigit
private static int b64decodeDigit(int c) -
b64validDigit
private static boolean b64validDigit(byte a) -
b64encodeOctet
private static void b64encodeOctet(byte[] to, int to_offset, byte[] from, int from_offset, int count) -
b64codes
private static byte b64codes(int which)
-