I want to convert a String to a Ruby byte array. I have a String and saving it in Hbase as binary byte array. Need to scan with some filter on key which is a binary byte array. Have a String like "U92w8GSBJ2BiHzGg" and need its representation like "\xFF\xA4\xDD\x13\x003\xE4\x85\xC7\x9D\xD5ZY\xF0\x1E" so that I can make query on Hbase shell like below
hbase(main):005:0> scan 't1', {FILTER => "(PrefixFilter ('\xFF\xA4\xDD\x13\x003\xE4')"}
Thanks in advance
will assume you mean: "want to convert a Ruby String to a Java byte array"
simply use
'a_ruby_binary_string'.to_java_bytes
(returnsbyte[]
under JRuby)