Class: HBase::ByteArray
- Inherits:
-
Object
- Object
- HBase::ByteArray
- Defined in:
- lib/hbase-jruby/byte_array.rb
Instance Attribute Summary collapse
-
#java ⇒ Object
readonly
Returns the value of attribute java.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ Object
-
#initialize(value) ⇒ ByteArray
constructor
A new instance of ByteArray.
- #stopkey_bytes_for_prefix ⇒ Object
Constructor Details
#initialize(value) ⇒ ByteArray
Returns a new instance of ByteArray.
6 7 8 |
# File 'lib/hbase-jruby/byte_array.rb', line 6 def initialize value @java = Util.to_bytes value end |
Instance Attribute Details
#java ⇒ Object (readonly)
Returns the value of attribute java.
4 5 6 |
# File 'lib/hbase-jruby/byte_array.rb', line 4 def java @java end |
Instance Method Details
#<=>(other) ⇒ Object
15 16 17 |
# File 'lib/hbase-jruby/byte_array.rb', line 15 def <=> other Bytes.compareTo(@java, other.java) end |
#eql?(other) ⇒ Boolean Also known as: ==
10 11 12 |
# File 'lib/hbase-jruby/byte_array.rb', line 10 def eql? other Arrays.equals(@java, other.java) end |
#hash ⇒ Object
34 35 36 |
# File 'lib/hbase-jruby/byte_array.rb', line 34 def hash Arrays.java_send(:hashCode, [Util::JAVA_BYTE_ARRAY_CLASS], @java) end |
#stopkey_bytes_for_prefix ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/hbase-jruby/byte_array.rb', line 19 def stopkey_bytes_for_prefix arr = @java.to_a csr = arr.length - 1 arr[csr] += 1 while csr >= 0 && arr[csr] > 127 csr -= 1 arr[csr] += 1 end if csr < 0 nil else arr[0..csr].to_java(Java::byte) end end |