大家好 小弟求助
我在用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解码的时候 如果读的流不全 是解不出来的。