Commit 7244a16d by wutong

StringBuffer给定初始值, 避免内存溢出

parent 34a59135
...@@ -181,8 +181,7 @@ public class AmazonAdProductJob extends PointJob { ...@@ -181,8 +181,7 @@ public class AmazonAdProductJob extends PointJob {
gzin = new GZIPInputStream(response.body().byteStream()); gzin = new GZIPInputStream(response.body().byteStream());
isr = new InputStreamReader(gzin, "utf8"); isr = new InputStreamReader(gzin, "utf8");
bufferedReader = new BufferedReader(isr); bufferedReader = new BufferedReader(isr);
StringBuffer sb = new StringBuffer((int) response.body().contentLength() * 2);
StringBuffer sb = new StringBuffer();
String str = null; String str = null;
while ((str = bufferedReader.readLine()) != null) { while ((str = bufferedReader.readLine()) != null) {
sb.append(str); sb.append(str);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment