先模拟一段从客户端接收到的URL码
//读取文件并转为字节码
FileInputStream fs = new FileInputStream(new File("D:\\aa.jpg"));
byte[] buffByte = new byte[fs.available()];
fs.read(buffByte);
fs.close();
//将字节码转为64位字节码
String base64 = new BASE64Encoder().encode(buffByte);
//将64位字节码转为URL码
String imgEncoder = URLEncoder.encode(base64, "UTF-8");
//开始解码
String imgDecoder = URLDecoder.decode(imgEncoder, "UTF-8");
BASE64Decoder decoder = new BASE64Decoder();
byte[] strByte = decoder.decodeBuffer(imgDecoder);
//输出为文件
FileOutputStream fout = new FileOutputStream("D:\\aaa.img");
fout.write(strByte);
fout.close();