Class: ExistDB::Resource::Binary

Inherits:
Base
  • Object
show all
Defined in:
lib/existdb/resource/binary.rb

Instance Method Summary collapse

Methods inherited from Base

#delete, #initialize, #inspect, #save

Methods included from ClassWrappingForwardable

#delegate_to_java

Constructor Details

This class inherits a constructor from ExistDB::Resource::Base

Instance Method Details

#contentObject



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_ioObject



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