fix file reading

This commit is contained in:
Daniella / Tove 2022-07-29 17:47:58 +02:00
parent c34eabcb4d
commit 44126aa477

View file

@ -152,13 +152,13 @@ public class BrowserContext {
return builder.toString();
}
stream = new FileInputStream(file);
int i = 0;
while((i = stream.read()) != -1) {
builder.append((char) i);
}
stream.close();
}
int i = 0;
while((i = stream.read()) != -1) {
builder.append((char) i);
}
stream.close();
if(!TryConfig.nocache)
cache.put(file, builder.toString());
@ -187,17 +187,18 @@ public class BrowserContext {
return builder.toString();
}
stream = new FileInputStream(file);
ByteArrayOutputStream s = new ByteArrayOutputStream();
int i = 0;
while((i = stream.read()) != -1) {
s.write(i);
}
stream.close();
s.close();
st = new String(s.toByteArray());
}
ByteArrayOutputStream s = new ByteArrayOutputStream();
int i = 0;
while((i = stream.read()) != -1) {
s.write(i);
}
stream.close();
s.close();
st = new String(s.toByteArray());
if(!TryConfig.nocache)
cache.put(file, st);
} catch (IOException e) {