Method: HBase::ByteArray#stopkey_bytes_for_prefix

Defined in:
lib/hbase-jruby/byte_array.rb

#stopkey_bytes_for_prefixbyte[]

Returns the first byte array whose prefix doesn’t match this byte array

Returns:

  • (byte[])


143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/hbase-jruby/byte_array.rb', line 143

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