如何改变BufferedReader的大小?
调用方法用户 BufferedReader 检索文本时出现内存不足错误。当我在模拟器上运行它多次时,调试工具告诉我应该减小它的大小。最终我遇到了 OOM。
那么我该如何减少 bufferedreader 的大小呢......
BufferedReader r = new BufferedReader(new InputStreamReader(is));
StringBuilder total = new StringBuilder();
String line;
while ((line = r.readLine()) != null) {
total.append(line + "\n");
imageUrl = total.toString();
I am getting a out of memory error when calling a method user BufferedReader to retreive text. The debug tool told me i should reduce its size when i ran it a number of times on the emulators. And eventually i got OOM.
So how do i go about reducing the size of the bufferedreader with this...
BufferedReader r = new BufferedReader(new InputStreamReader(is));
StringBuilder total = new StringBuilder();
String line;
while ((line = r.readLine()) != null) {
total.append(line + "\n");
imageUrl = total.toString();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为 BufferedReader 有一个构造函数 BufferedReader(Reader in, int BufferSize)
试试这个
i think BufferedReader has a constructor BufferedReader(Reader in, int BufferSize)
try this