serialization

ClassNotFoundException during Deserialization of a just-serializaed class

这一生的挚爱 提交于 2020-01-04 09:06:28
问题 I was having an issue with deserializing an object. The current project has a plugin-style architecture, so I have jars that contain class files that are loaded at runtime. I was unable to deserialize an object that contained a class that was found in one of those jars, so I wrote a quick test method that gets called mid-stream that just loaded the plugins, instantiates the correct one (the object implements a particular interface so I can identify it via .isAssignableFrom(..) ), serializes

XML serialize annotations

拟墨画扇 提交于 2020-01-04 07:25:07
问题 I have a situation where I have an xml file that I don't want to modify. The AddAnnotation function in XElement class provides an option to add memory-only data which is not serialized and not part of the XML. I want to be able to save these annotations (for example: to another xml file) and then to deserialize both the xml and the annotations in order to get the same object I had. I don't want to change the original xml and that's the reason that I use annotations. To summarize, I want to be

Send database data through socket connection

可紊 提交于 2020-01-04 06:05:22
问题 I have a distributed java application and I want to send the database data between two databases which are in seperate computer systems or android devices. Which is the best way to transfer tha table data throw a socket connection?I think about send table rows as a text lines, or xml elements or create a class(implements the Serializable inteface) for every table and tranfer an arraylist of that objects for each table. Which is in your opinion the more effetive solution? There is any other

Type Information within serialized JSON using GSON

独自空忆成欢 提交于 2020-01-04 05:55:19
问题 Using Jackson we have the option to attach the type info to the serialized object (http://jackson.codehaus.org/1.5.5/javadoc/org/codehaus/jackson/annotate/JsonTypeInfo.html). Is there a way to do this using GSON like: { propertyName:"test", _className:"foo.bar.TestClass" } The idea is to have it generic, so when a ArrayList<Object> is deserialized, the right object instances are restored with it. I saw this question: https://stackoverflow.com/a/8683689/1001027 that is more or less what I need

protobuf-net : how to annotate properties of derived type?

一笑奈何 提交于 2020-01-04 05:44:13
问题 For the latest version of protobuf-net ( r640 folder ), how to best annotate a ProtoMember that is a derived type ? [ProtoBuf.ProtoContract(Name=@"MyBaseTypeProto")] [Serializable] public partial class MyBaseType: ProtoBuf.IExtensible { ... } [ProtoBuf.ProtoContract(Name=@"MyDerivedTypeProto")] [Serializable] public partial class MyDerivedType : MyBaseType, ProtoBuf.IExtensible { ... } [ProtoBuf.ProtoContract(Name=@"MyMessageProto")] [Serializable] public partial class MyMessage : ProtoBuf

Nested JSONObject Deserialize to JSONObject

夙愿已清 提交于 2020-01-04 05:16:16
问题 So I'm working on deserializing a nested JSONObject, but don't want to create a class for each nested object. I was trying to take on of the nested JSONObjects and put it in a JSONObject. public class ContainerStatus { @JsonProperty("name") private String name; @JsonProperty("state") private JSONObject state; @JsonProperty("lastState") private JSONObject lastState; @JsonProperty("ready") private Boolean ready; @JsonProperty("restartCount") private Integer restartCount; @JsonProperty("image")

WCF Serialize Array or Collection Without a Container

别说谁变了你拦得住时间么 提交于 2020-01-04 05:08:18
问题 I have a situation where we are connecting to a SOAP service. The response we get back looks something like this: <SomeObject> <item1>1</item1> <thing1>2</thing1> <arrayItem><foo>text</foo></arrayItem> <arrayItem><foo>text1</foo></arrayItem> <arrayItem><foo>text2</foo></arrayItem> </SomeObject> I need to replicate the output of that response. The issue I keep running into is that the <arrayItem> 's are encapsulated by <arrayItemList> and I really need the <arrayItemList> to go away. Does

What is correct way to structure delphi compound components for stream reading?

。_饼干妹妹 提交于 2020-01-04 04:54:22
问题 I am having trouble reloading a saved compound component in Delphi where the subcomponent (a TChart) appears to be being created twice. When I create my component in code, it works fine. My component is a TPanel hosting a client aligned TChart and I create the single series and its data myself. Here is my code: type TMyChart = class( TPanel ) PRIVATE FChart : TChart; PROTECTED procedure Notification( AComponent : TComponent; Operation : TOperation ); override; PUBLIC constructor Create(

Why does unserialize in PHP keep returning false?

北城余情 提交于 2020-01-04 03:51:22
问题 I've just written the easiest script in the world, but still I can't get it to work, and it's mighty strange. I want to use jQuery to catch some input field values and serialize them with jQuery's serialize() . I then send the serialized string to the server to unserialize it. Here's the output I get from the serializing in jQuery, this is what I send to the server. field1=value1&field2=value2&field3=value3 And here's the function, public function unserialize_input() { $str = $this->input-

Why does unserialize in PHP keep returning false?

孤者浪人 提交于 2020-01-04 03:51:07
问题 I've just written the easiest script in the world, but still I can't get it to work, and it's mighty strange. I want to use jQuery to catch some input field values and serialize them with jQuery's serialize() . I then send the serialized string to the server to unserialize it. Here's the output I get from the serializing in jQuery, this is what I send to the server. field1=value1&field2=value2&field3=value3 And here's the function, public function unserialize_input() { $str = $this->input-