erlang-driver

How to read erlang term from redis by using java client?

ε祈祈猫儿з 提交于 2019-12-23 02:25:13
问题 e.g. I save the tuple T = {k1, v1, k2, v2} to the redis by jedis: eredis:q(Conn, ["SET", <<"mykey">>, term_to_binary(T)]). I am trying to use the code below to read this erlang term: Jedis j = Redis.pool.getResource(); byte[] t = j.get("mykey").getBytes(); OtpInputStream ois = new OtpInputStream(t); System.out.println(OtpErlangObject.decode(ois)); The error is: com.ericsson.otp.erlang.OtpErlangDecodeException: Uknown data type: 239. So how can I get the erlang term correctly? Erlang side:

How to read erlang term from redis by using java client?

孤者浪人 提交于 2019-12-06 16:38:33
e.g. I save the tuple T = {k1, v1, k2, v2} to the redis by jedis: eredis:q(Conn, ["SET", <<"mykey">>, term_to_binary(T)]). I am trying to use the code below to read this erlang term: Jedis j = Redis.pool.getResource(); byte[] t = j.get("mykey").getBytes(); OtpInputStream ois = new OtpInputStream(t); System.out.println(OtpErlangObject.decode(ois)); The error is: com.ericsson.otp.erlang.OtpErlangDecodeException: Uknown data type: 239. So how can I get the erlang term correctly? Erlang side: term_to_binary({k1, v1, k2, v2}). <<131,104,4,100,0,2,107,49,100,0,2,118,49,100,0,2,107,50, 100,0,2,118,50