Class: ExistDB::Resource::Binary
- Inherits:
-
Base
- Object
- Base
- ExistDB::Resource::Binary
show all
- Defined in:
- lib/existdb/resource/binary.rb
Instance Method Summary
collapse
Methods inherited from Base
#delete, #initialize, #inspect, #save
#delegate_to_java
Instance Method Details
#content ⇒ Object
10
11
12
|
# File 'lib/existdb/resource/binary.rb', line 10
def content
to_io.read
end
|
#content=(data) ⇒ Object
5
6
7
8
|
# File 'lib/existdb/resource/binary.rb', line 5
def content=(data)
bytes = data.to_s.to_java_bytes
@obj.setContent(bytes)
end
|
#to_io ⇒ Object
14
15
16
17
|
# File 'lib/existdb/resource/binary.rb', line 14
def to_io
input_stream = @obj.getStreamContent
return Java.java_to_ruby(org.jruby.RubyIO.new(JRuby.runtime, input_stream).java_object)
end
|