i am using memcache , for communicating between java and c#. c# put data into memcache in byte[] format and from java application trying to read that byte array but in Java i m getting String Object . Sample :- C# code
MemcachedClient _mc = new MemcachedClient();
_mc.Serverlist = { "127.0.0.1:11211" }
byte[] stestValue = GetBytes("india");
m_c.set("key1",stestValue);
private byte[] GetBytes(string str)
{
byte[] bytes = new byte[str.Length * sizeof(char)];
System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length);
return bytes;
}
Java Code :-// to fetch data which we set in memcache having key :- Key1
MemcachedClient mcc = new MemcachedClient(new InetSocketAddress("127.0.0.1", 11211));
Object value = mcc.get("key1");
here we get string object in Value rather than byte[]
.