Class: Embulk::Buffer
- Inherits:
-
String
- Object
- String
- Embulk::Buffer
- Defined in:
- lib/embulk/buffer.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_java(java_buffer) ⇒ Object
3 4 5 6 7 8 |
# File 'lib/embulk/buffer.rb', line 3 def self.from_java(java_buffer) byte_list = org.jruby.util.ByteList.new(java_buffer.array(), java_buffer.offset(), java_buffer.limit(), false) buffer = new buffer.replace(org.jruby.RubyString.new(JRuby.runtime, self, byte_list).dup) # TODO simplify buffer end |
.from_ruby_string(string) ⇒ Object
10 11 12 13 |
# File 'lib/embulk/buffer.rb', line 10 def self.from_ruby_string(string) b = Buffer.new(string) b.force_encoding('ASCII-8BIT') end |
Instance Method Details
#to_java ⇒ Object
15 16 17 |
# File 'lib/embulk/buffer.rb', line 15 def to_java Java::org.embulk.spi.BufferImpl.wrap(to_java_bytes) end |