当前位置: 代码迷 >> Android >> 关于Base64解码的有关问题
  详细解决方案

关于Base64解码的有关问题

热度:31   发布时间:2016-04-28 07:35:59.0
求助 关于Base64解码的问题
大家好 小弟求助

我在用Base64解码一个比较大的文件 大概在1M左右吧

然后我的做法是

FileOutputStream outStream = new FileOutputStream(localFile);
InputStream inputStream = conn.getInputStream();
byte[] buffer = new byte[1024];
int len = 0;
byte[] decode = null;
while ((len = inputStream.read(buffer)) != -1)
{
decode = Base64.decode(buffer, 0, len, Base64.DEFAULT);
outStream.write(decode, 0, decode.length);
}
inputStream.close();
outStream.close();


运行时提示java.lang.IllegalArgumentException: bad base-64

求助这是什么问题 难道不能分段解码?
只能整个解码么?(文件比较大比较多,容易溢出啊)
求助大家了

------解决方案--------------------
如果是大文件,你调整JVM堆内存,
base64解码的时候 如果读的流不全 是解不出来的。
  相关解决方案