Package com.google.api.client.util
Class Base64
java.lang.Object
com.google.api.client.util.Base64
Proxy for version 1.6 (or newer) of the Apache Commons Codec
Base64
implementation.
This is needed in order to support platforms like Android which already include an older version of the Apache Commons Codec (Android includes version 1.3). To avoid a dependency library conflict, this library includes a reduced private copy of version 1.6 (or newer) of the Apache Commons Codec (using a tool like jarjar).
- Since:
- 1.8
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
decodeBase64
(byte[] base64Data) Decodes Base64 data into octets.static byte[]
decodeBase64
(String base64String) Decodes a Base64 String into octets.static byte[]
encodeBase64
(byte[] binaryData) Encodes binary data using the base64 algorithm but does not chunk the output.static String
encodeBase64String
(byte[] binaryData) Encodes binary data using the base64 algorithm but does not chunk the output.static byte[]
encodeBase64URLSafe
(byte[] binaryData) Encodes binary data using a URL-safe variation of the base64 algorithm but does not chunk the output.static String
encodeBase64URLSafeString
(byte[] binaryData) Encodes binary data using a URL-safe variation of the base64 algorithm but does not chunk the output.
-
Constructor Details
-
Base64
private Base64()
-
-
Method Details
-
encodeBase64
public static byte[] encodeBase64(byte[] binaryData) Encodes binary data using the base64 algorithm but does not chunk the output.- Parameters:
binaryData
- binary data to encode ornull
fornull
result- Returns:
- byte[] containing Base64 characters in their UTF-8 representation or
null
fornull
input - See Also:
-
encodeBase64String
Encodes binary data using the base64 algorithm but does not chunk the output.- Parameters:
binaryData
- binary data to encode ornull
fornull
result- Returns:
- String containing Base64 characters or
null
fornull
input - See Also:
-
encodeBase64URLSafe
public static byte[] encodeBase64URLSafe(byte[] binaryData) Encodes binary data using a URL-safe variation of the base64 algorithm but does not chunk the output. The url-safe variation emits - and _ instead of + and / characters.- Parameters:
binaryData
- binary data to encode ornull
fornull
result- Returns:
- byte[] containing Base64 characters in their UTF-8 representation or
null
fornull
input - See Also:
-
encodeBase64URLSafeString
Encodes binary data using a URL-safe variation of the base64 algorithm but does not chunk the output. The url-safe variation emits - and _ instead of + and / characters.- Parameters:
binaryData
- binary data to encode ornull
fornull
result- Returns:
- String containing Base64 characters or
null
fornull
input - See Also:
-
decodeBase64
public static byte[] decodeBase64(byte[] base64Data) Decodes Base64 data into octets.- Parameters:
base64Data
- Byte array containing Base64 data ornull
fornull
result- Returns:
- Array containing decoded data or
null
fornull
input - See Also:
-
decodeBase64
Decodes a Base64 String into octets.- Parameters:
base64String
- String containing Base64 data ornull
fornull
result- Returns:
- Array containing decoded data or
null
fornull
input - See Also:
-