the data is serialized by c# protobuf-net and set to the redis, now i want to get the data and deserialize it in a java program,everything is ok expect the datetime fields ,they can not be serialized properly. in c# program the data is serialized from the entity as follow,and set to redis
[Serializable]
[ProtoContract]
public class TestMsg
{
public TestMsg();
[ProtoMember(1)]
public string message { get; set; }
[ProtoMember(2)]
public DateTime UpdateTime { get; set; }
}
in my java program,the proto flie is as follow:
syntax = "proto2";
option java_outer_classname = "TestMsgEntity";
message TestMsg {
required string Message = 1;//
required string UpdateTime = 2;// it can not be deserialized properly.if I change is to long,then i get zero .
}
//java code
byte[] byteArrayRedis = provider.getbyte("keyname"); //get the data from redis
ByteArrayInputStream baiContent = new ByteArrayInputStream(byteArrayRedis);
try {
TestMsgEntity.TestMsg msg = TestMsgEntity.TestMsg.parseFrom(baiContent);
String message = msg.getMessage (); //it is ok
String lastUpdate =msg.getLastUpdateTime();//how can i get the value?
}