Class: Rhino::IOReader
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(io) ⇒ IOReader
constructor
A new instance of IOReader.
- #read(charbuffer, offset, length) ⇒ Object
Constructor Details
#initialize(io) ⇒ IOReader
Returns a new instance of IOReader.
155 156 157 |
# File 'lib/rhino/context.rb', line 155 def initialize(io) @io = io end |
Instance Method Details
#read(charbuffer, offset, length) ⇒ Object
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/rhino/context.rb', line 159 def read(charbuffer, offset, length) begin str = @io.read(length) if str.nil? return -1 else jstring = java.lang.String.new(str) for i in 0 .. jstring.length - 1 charbuffer[i + offset] = jstring.charAt(i) end return jstring.length end rescue StandardError => e raise java.io.IOException.new, "Failed reading from ruby IO object" end end |