可能重复:
OutOfMemoryError : When receiving XML response of 2.3 MB如何在字符串中存储大型二进制数据?
我从网络服务,这是大量的XML格式的二进制字符串的响应串。我可以将响应数据存储到对象中。但我想分析这些响应并将其存储到本地数据库中。所以我必须将对象数据转换为字符串。如果我将对象数据转换为字符串。它发生“内存问题”。
我的回应是这样的
<xmlstring>
<oneslip>78364</oneslip>
<threeslip>Hello</threeslip>
<twoslip>3</twoslip>
<Binarydata>"Here the large amount of binary data"</Binarydata>
<oneslip>78364</oneslip>
<threeslip>Hello</threeslip>
<twoslip>3</twoslip>
<Binarydata>"Here the large amount of binary data"</Binarydata>
..
..
..
最多的50
</xmlstring>
尝试使用StringBuffer而不是字符串 – 2012-07-11 11:18:49
@imrankhan当您可以使用StringBuilder时,请不要使用StringBuffer。 – 2012-08-13 07:54:57