Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void load(Ruby runtime, boolean wrap) {
} else {
name = CompiledScriptLoader.getFilenameFromPathAndName(resource.getPath(), name, resource.isAbsolute());

runtime.loadFile(name, new LoadServiceResourceInputStream(in), wrap);
runtime.loadFile(name, in, wrap);
}
} catch (IOException e) {
throw runtime.newIOErrorFromException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,9 @@ public byte[] getBytes() {
return buf;
}

private static final int READ_CHUNK_SIZE = 16384;

private void bufferEntireStream(InputStream stream) throws IOException {
byte[] chunk = new byte[READ_CHUNK_SIZE];
int bytesRead;
while ((bytesRead = stream.read(chunk)) != -1) {
byte[] newbuf = new byte[buf.length + bytesRead];
System.arraycopy(buf, 0, newbuf, 0, buf.length);
System.arraycopy(chunk, 0, newbuf, buf.length, bytesRead);
buf = newbuf;
count = buf.length;
}
byte[] all = stream.readAllBytes();
buf = all;
count = all.length;
}
}