Java8
Java8上的自带Base64工具 java.util.Base64;
1 | //编码 |
Android
Android SDK 自带 android.util.Base64;
| Public methods |
| ———- | — |
| static byte[] | decode(String str, int flags)
Decode the Base64-encoded data in input and return the data in a new byte array. |
| static byte[] | decode(byte[] input, int flags)
Decode the Base64-encoded data in input and return the data in a new byte array. |
| static byte[] | decode(byte[] input, int offset, int len, int flags)
Decode the Base64-encoded data in input and return the data in a new byte array. |
| static byte[] | encode(byte[] input, int flags)
Base64-encode the given data and return a newly allocated byte[] with the result. |
| static byte[] | encode(byte[] input, int offset, int len, int flags)
Base64-encode the given data and return a newly allocated byte[] with the result. |
| static String | encodeToString(byte[] input, int offset, int len, int flags)
Base64-encode the given data and return a newly allocated String with the result. |
| static String | encodeToString(byte[] input, int flags)
Base64-encode the given data and return a newly allocated String with the result. |
1 | import android.util.Base64; |