Sha256: 87a4a31e2749aff883c9d8d32dee1eb9fb349fa51108a55ce1113b7665dfc5cf

Contents?: true

Size: 635 Bytes

Versions: 3

Compression:

Stored size: 635 Bytes

Contents

class HBase
# @private
class ByteArray
  attr_reader :java

  def initialize value
    @java = Util.to_bytes value
  end

  def eql? other
    Arrays.equals(@java, other.java)
  end
  alias == eql?

  def <=> other
    Bytes.compareTo(@java, other.java)
  end

  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

  def hash
    Arrays.java_send(:hashCode, [Util::JAVA_BYTE_ARRAY_CLASS], @java)
  end
end#ByteArray
end#HBase

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hbase-jruby-0.1.3-java lib/hbase-jruby/byte_array.rb
hbase-jruby-0.1.2-java lib/hbase-jruby/byte_array.rb
hbase-jruby-0.1.1-java lib/hbase-jruby/byte_array.rb