Today, using Base64 encoding to transfer JSON strings, the Android side never see the picture!
First, we find that the length of JSON string received by Android is inconsistent, and the JSON data received by Android is filtered out by the "/" and "+" in the server data.
View data discovery before using: New Base64encoder (). Encode (bytes) to turn byte[].
Cross-platform transfer Base64 encoded data is used: base64.encodebase64urlsafestring (bytes) (method meaning: Encode binary data using Base64 algorithm with URL security change but not block output).
| Modifier and Type |
Method and Description |
static byte[] |
decodeBase64(byte[] base64Data)Decodes Base64 data into octets |
static byte[] |
decodeBase64(String base64String)Decodes a Base64 String into octets |
static BigInteger |
decodeInteger(byte[] pArray)Decodes a byte64-encoded integer according to crypto standards such as the "s xml-signature |
static byte[] |
encodeBase64(byte[] binaryData)Encodes binary data using the Base64 algorithm but does not chunk the output. |
static byte[] |
encodeBase64(byte[] binaryData, boolean isChunked)Encodes binary data using the Base64 algorithm, optionally chunking the output into character blocks. |
static byte[] |
encodeBase64(byte[] binaryData, boolean isChunked, boolean urlSafe)Encodes binary data using the Base64 algorithm, optionally chunking the output into character blocks. |
static byte[] |
encodeBase64(byte[] binaryData, boolean isChunked, boolean urlSafe, int maxResultSize)Encodes binary data using the Base64 algorithm, optionally chunking the output into character blocks. |
static byte[] |
encodeBase64Chunked(byte[] binaryData)Encodes binary data using the Base64 algorithm and chunks the encoded output into character blocks |
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. |
static byte[] |
encodeInteger(BigInteger bigInt)Encodes to a byte64-encoded an integer according to crypto standards such as a "s xml-signature |
static boolean |
isArrayByteBase64(byte[] arrayOctet)Deprecated. 1.5 Use isBase64(byte[]) , would be is removed in 2.0. |
static boolean |
isBase64(byte octet)Returns whether or not, in the octet base, alphabet. |
static boolean |
isBase64(byte[] arrayOctet)Tests a given byte array to see if it contains only valid characters within the Base64 alphabet. |
static boolean |
isBase64(String base64)Tests a given String to see if it contains only valid characters within the Base64 alphabet. |
protected boolean |
isInAlphabet(byte octet)Returns whether or not are in the octet Base64 alphabet. |
boolean |
isUrlSafe()Returns our current encode mode. |
Cross-platform base64 data transfer attention issues