2

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[].

ParkerHalo
  • 4,341
  • 9
  • 29
  • 51
DJ DJ
  • 21
  • 1

1 Answers1

0

yes i have tried to get byte[] from this but this byte array length is different from c# byte array.My requirement is to parse byte array by it's length so requirement is length of byte[] in c# = length in byte[] in Java

DJ DJ
  • 21
  • 1