class Nashorn::IOReader
@private
Public Class Methods
new(io)
click to toggle source
# File lib/nashorn/context.rb, line 168 def initialize(io) @io = io end
Public Instance Methods
read(buffer, offset, length)
click to toggle source
int Reader#read(char[] buffer, int offset, int length)
# File lib/nashorn/context.rb, line 173 def read(buffer, offset, length) str = nil begin str = @io.read(length) rescue StandardError => e raise java.io.IOException.new("failed reading from ruby IO object: #{e.inspect}") end return -1 if str.nil? jstr = str.to_java for i in 0 .. jstr.length - 1 buffer[i + offset] = jstr.charAt(i) end return jstr.length end