fix resource loading

This commit is contained in:
Daniella / Tove 2022-07-13 14:44:46 +02:00
parent 511ba3dbe6
commit fd83813ecf

View file

@ -148,13 +148,14 @@ public class BrowserContext {
return builder.toString(); return builder.toString();
} }
stream = new FileInputStream(file); stream = new FileInputStream(file);
}
int i = 0; int i = 0;
while((i = stream.read()) != -1) { while((i = stream.read()) != -1) {
builder.append((char) i); builder.append((char) i);
} }
stream.close(); stream.close();
}
if(!TryConfig.nocache) if(!TryConfig.nocache)
cache.put(file, builder.toString()); cache.put(file, builder.toString());
@ -183,6 +184,8 @@ public class BrowserContext {
return builder.toString(); return builder.toString();
} }
stream = new FileInputStream(file); stream = new FileInputStream(file);
}
ByteArrayOutputStream s = new ByteArrayOutputStream(); ByteArrayOutputStream s = new ByteArrayOutputStream();
int i = 0; int i = 0;
@ -193,7 +196,6 @@ public class BrowserContext {
stream.close(); stream.close();
s.close(); s.close();
st = new String(s.toByteArray()); st = new String(s.toByteArray());
}
if(!TryConfig.nocache) if(!TryConfig.nocache)
cache.put(file, st); cache.put(file, st);
} catch (IOException e) { } catch (IOException e) {