这个是因为byte[]转换成String时会遇到大量根本不可以显示的字符,这样就是错误的原由你可以使用
String result = new sun.misc.BASE64Encoder().encode(buf);这样可以完成避免上述问题
byte[] buf2 = new sun.misc.BASE64Decoder().encodeBuffer(result);
String result = new sun.misc.BASE64Encoder().encode(buf);这样可以完成避免上述问题
byte[] buf2 = new sun.misc.BASE64Decoder().encodeBuffer(result);
解决方案 »
- Hibernate连接sqlserver2000老报错
- strurs2.1.6的零配置问题
- JIRA与TOMCAT的问题________在线等 = =||
- eclipse加载插件的问题
- tomcat启动後过一段时间后就自动断掉了
- 在jboss下发布邮件发送时遇到麻烦
- android开发中如何获取manifest.xml文件中的信息?
- axis2写客户端调用spring3.x的restful服务端报错
- 请问各位大侠:J2EE和.net架构有什么不同或优势?
- java.lang.IllegalStateException: BeanFactory not initialized or already closed
- jsp页面输出文件路径的file框怎么做
- [请教]byte[]与字符串转换的问题
//byte[]<->String<->byte[]
String b = new sun.misc.BASE64Encoder().encode(testbyte1);
byte[] testbyte3 = new sun.misc.BASE64Decoder().decodeBuffer(b);
~~~~~~~~~~~~
testbyte2 = unzip(testbyte3);
这样可以.
http://community.csdn.net/Expert/topic/3907/3907236.xml?temp=.7387812