We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c6913dd commit 6339af2Copy full SHA for 6339af2
1 file changed
src/src/com/tns/FileSystem.java
@@ -50,13 +50,14 @@ public static String readAll(InputStream inputStream) throws IOException
50
private final static byte[] buff = new byte[65536];
51
52
public static String readText(File file) throws FileNotFoundException, IOException{
53
- if (file.length() < buff.length)
+ int fileLength = (int)file.length();
54
+ if (fileLength < buff.length)
55
{
56
FileInputStream fis = null;
57
try
58
59
fis = new FileInputStream(file);
- int length = fis.read(buff);
60
+ int length = fis.read(buff, 0, fileLength);
61
return new String(buff, 0, length);
62
}
63
finally
0 commit comments