Fixed a nasty bug that made the downloaded xml to be incorrect in some cases.

This commit is contained in:
Robert Kolner committed 2011-09-28 21:37:07 +02:00
1 parent 8874f389b0
commit 104f780b3f
1 file changed
+3 -2
@@ -127,8 +127,9 @@ public class FeedFetcher {
OutputStream os = c.openFileOutput(LOCAL_FILENAME, Context.MODE_PRIVATE);
byte[] inputBuffer = new byte[BUFFER_SIZE];
while (in.read(inputBuffer) > 0) {
os.write(inputBuffer);
int bytes = 0;
while ((bytes = in.read(inputBuffer)) > 0) {
os.write(inputBuffer, 0, bytes);
inputBuffer = new byte[BUFFER_SIZE];
}
os.close();