In Java, Base64 encoding and decoding is performed on strings.

xiaoxiao2021-03-06  89

Import sun.misc.base64decoder; import sun.misc.base64encoder; // encodes public static string getBase64 (String s) {if (s == null) {Return NULL;} return (new sun.misc.base64encoder ()). Encode (S.GetBytes ());} // decoding

public static String getFromBASE64 (String s) {if (s == null) return null; BASE64Decoder decoder = new BASE64Decoder (); try {byte [] b = decoder.decodeBuffer (s); return new String (b);} catch (Exception E) {return null;}} can solve the characters encrypted in the network. . .

转载请注明原文地址:https://www.9cbs.com/read-106417.html

New Post(0)