\r
package com.badlogic.gdx.files;\r
\r
+import com.badlogic.gdx.Files;\r
+import com.badlogic.gdx.Files.FileType;\r
+import com.badlogic.gdx.Gdx;\r
+import com.badlogic.gdx.utils.GdxRuntimeException;\r
+\r
import java.io.BufferedInputStream;\r
import java.io.BufferedReader;\r
import java.io.File;\r
import java.io.UnsupportedEncodingException;\r
import java.io.Writer;\r
\r
-import com.badlogic.gdx.Files;\r
-import com.badlogic.gdx.Files.FileType;\r
-import com.badlogic.gdx.Gdx;\r
-import com.badlogic.gdx.utils.GdxRuntimeException;\r
-\r
/** Represents a file or directory on the filesystem, classpath, Android SD card, or Android assets directory. FileHandles are\r
* created via a {@link Files} instance.\r
* @author mzechner\r
int count = input.read(buffer, position, buffer.length - position);\r
if (count == -1) break;\r
position += count;\r
- if (count == 0 && position == buffer.length) {\r
+ if (position == buffer.length) {\r
+ int b = input.read();\r
+ if (b == -1) break;\r
// Grow buffer.\r
byte[] newBuffer = new byte[buffer.length * 2];\r
System.arraycopy(buffer, 0, newBuffer, 0, position);\r
buffer = newBuffer;\r
+ buffer[position++] = (byte)b;\r
}\r
}\r
} catch (IOException ex) {\r