Module: Eurydice::Pelops::ByteHelpers
- Extended by:
- ByteHelpers
- Included in:
- ByteHelpers, ColumnFamily, Mutator
- Defined in:
- lib/eurydice/pelops.rb
Constant Summary collapse
- BYTES_FROM_LONG_METHOD =
::Pelops::Bytes.java_method(:fromLong, [Java::long])
Instance Method Summary collapse
- #byte_array_to_s(ba, type = nil) ⇒ Object
- #empty_pelops_bytes ⇒ Object
- #nio_bytes_to_s(nb) ⇒ Object
- #pelops_bytes_to_s(pb) ⇒ Object
- #to_byte_array(str) ⇒ Object
- #to_nio_bytes(str) ⇒ Object
- #to_pelops_bytes(obj, type = nil) ⇒ Object
Instance Method Details
#byte_array_to_s(ba, type = nil) ⇒ Object
82 83 84 85 86 87 88 89 |
# File 'lib/eurydice/pelops.rb', line 82 def byte_array_to_s(ba, type=nil) case type when :long ::Pelops::Bytes.new(ba).to_long else String.from_java_bytes(ba) end end |
#empty_pelops_bytes ⇒ Object
51 52 53 |
# File 'lib/eurydice/pelops.rb', line 51 def empty_pelops_bytes ::Pelops::Bytes::EMPTY end |
#nio_bytes_to_s(nb) ⇒ Object
78 79 80 |
# File 'lib/eurydice/pelops.rb', line 78 def nio_bytes_to_s(nb) pelops_bytes_to_s(::Pelops::Bytes.new(nb)) end |
#pelops_bytes_to_s(pb) ⇒ Object
74 75 76 |
# File 'lib/eurydice/pelops.rb', line 74 def pelops_bytes_to_s(pb) String.from_java_bytes(pb.to_byte_array) end |
#to_byte_array(str) ⇒ Object
70 71 72 |
# File 'lib/eurydice/pelops.rb', line 70 def to_byte_array(str) str.to_java_bytes end |
#to_nio_bytes(str) ⇒ Object
66 67 68 |
# File 'lib/eurydice/pelops.rb', line 66 def to_nio_bytes(str) to_pelops_bytes(str).bytes end |
#to_pelops_bytes(obj, type = nil) ⇒ Object
57 58 59 60 61 62 63 64 |
# File 'lib/eurydice/pelops.rb', line 57 def to_pelops_bytes(obj, type=nil) case type when :long BYTES_FROM_LONG_METHOD.call(obj) else ::Pelops::Bytes.new(obj.to_s.to_java_bytes) end end |