//短信1 String targetNumber1 = "13459265222"; String sendNumber1 = "106589658"; String content1 = "这是一条群发测试短信,短信1"; //短信2 String targetNumber2 = "13459265223"; String sendNumber2 = "106589659"; String content2 = "这是一条群发测试短信,短信2"; StringBuffer csvStr = new StringBuffer(); //组装短信1 csvStr.append(targetNumber1).append("|").append(sendNumber1).append("|").append(URLEncoder.encode(content1, "utf-8")); //加入记录间的分隔符 csvStr.append(" "); //组装短信2 csvStr.append(targetNumber2).append("|").append(sendNumber2).append("|").append(URLEncoder.encode(content2, "utf-8")); //base64编码 String massInfo = Base64.encode(csvStr.toString()); System.out.println(massInfo); String str = Base64.decode("RDEzMkYxRDFFODE4NkU5OTU3QTAyQTgyMjQ3QkY1MkY4NkNENjc3NE1UTTBOVGt5TmpVeU1qSjhNVEEyTlRnNU5qVTRmQ1ZGT0NWQ1JpVTVPU1ZGTmlVNU9DVkJSaVZGTkNWQ09DVTRNQ1ZGTmlVNVJDVkJNU1ZGTnlWQ1JTVkJOQ1ZGTlNVNFJpVTVNU1ZGTmlWQ05TVTRRaVZGT0NWQlJpVTVOU1ZGTnlVNVJpVkJSQ1ZGTkNWQ1JpVkJNU1V5UXlWRk55VTVSaVZCUkNWRk5DVkNSaVZCTVRFTkNqRXpORFU1TWpZMU1qSXpmREV3TmpVNE9UWTFPWHdsUlRnbFFrWWxPVGtsUlRZbE9UZ2xRVVlsUlRRbFFqZ2xPREFsUlRZbE9VUWxRVEVsUlRjbFFrVWxRVFFsUlRVbE9FWWxPVEVsUlRZbFFqVWxPRUlsUlRnbFFVWWxPVFVsUlRjbE9VWWxRVVFsUlRRbFFrWWxRVEVsTWtNbFJUY2xPVVlsUVVRbFJUUWxRa1lsUVRFeQ=="); System.out.println(str); String records[] = str.split(" "); for(String record: records){ String fields[] = record.split("\|"); System.out.println("============================="); for(String field: fields){ if(field.length() > 20){ field = URLDecoder.decode(field, "utf-8"); } System.out.println(field); } System.out.println("============================="); }