fix file reading
This commit is contained in:
parent
c34eabcb4d
commit
44126aa477
1 changed files with 17 additions and 16 deletions
|
@ -152,13 +152,13 @@ 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());
|
||||||
|
@ -187,6 +187,7 @@ 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;
|
||||||
|
@ -197,7 +198,7 @@ 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) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue