serialization

Binary file & saved game formatting

I am working on a small roguelike game, and need some help with creating save games. I have tried several ways of saving games, but the load always fails, because I am not exactly sure what is a good way to mark the beginning of different sections for the player, entities, and the map. What would be a good way of marking the beginning ...

How does jQuery deserialize JSON?

I am using jQuery.ajax(...) to retrieve JSON data from an ASP.NET MVC service. When the server encounters an exception, I send a 400 Bad Request status back to the client and send my exception as a JsonResult: Response.StatusCode = 400; return Json(new { ex.Message, ex.StackTrace }); And here's my jQuery code: $.ajax( { type: "PO...

Closing a stream after an exception

I open a stream and then deserialize the data in the stream. However, I added a member to the SavedEventSet object so now when I try to open an old file, it throws the exception on the deserialization line. This is fine with me (for now) but the problem is that I handle the exception, but never close the stream (because the exception o...

Why must I remove the xmlns attribute to deserialize my XML file?

Problem I'm using Xsd2Code (a .NET class generator for XSD schema) on a simple settings file schema. For some reason, when I attempt to use the built-in LoadFromFile() or Deserialize() methods, I get an exception that seems to be related to the xmlns attributes in my XSD and XML files. If I remove these attributes, the exception goes aw...

In java, is it possible to add the Serializable interface to class that doesn't have it at runtime?

There is a class I want to serialize, and it implements Serializable, but one of the objects it contains does not implement Serializable. Is there a way to modify the class at runtime to make it implement the Serializable interface so I can serialize it? I can't change it at compile time because its a third party library. Maybe I woul...

In java how do I serialize a class that is not marked Serializable?

There is a specific class in a third party library that I want to serialize. How would I go about doing this? I'm assuming I will have to write a method that takes in an object of the class and uses reflection to get the private member values. Then for deserialization I would use reflection to put the values back. Would this work...

deserializing messages from msmq send via netmsmq binding

We have wcf service and on error we send messages to "poison" queue using netmsmq binding rather than using System.Messaging's Send Method(). We tried fetching those message out of that poison queue but when deserializing i got a lot of junk data with hexadecimal values... ...

Prevent WCF client from deserializing

I have a WCF client proxy which reads from a SOAP web service. I do not control the service, only the client proxy. The result of invoking one of the operations of the service is defined as a very large XML schema, of which only a small subset is relevant in my application. I have created a custom WCF behavior which allows me to parse t...

How to get a serialized array from a client form to a server using the GM_xmlhttpRequest

I used JQuery.serializeArray() on a form to create an array of objects on a GreaseMonkey application: [ { name: a value: 1 }, { name: b value: 2 }, { name: c value: 3 }, { name: d value: 4 }, { name: e value: 5 } ] I need to use GM_xmlhttpRequest to serve these fields back to...

How to remove null DataMember properties from the response in wcf

I am returning the xml output to the browser with a wcf webservice, if a property of a DataContract is null, it still comes through in the response as <Id i:nil="true" /> Is there a way to have it not return in the response at all? ...

BinaryFormatter deserialize gives SerializationException

I'm getting an: System.Runtime.Serialization.SerializationException: Unable to find assembly 'myNameSpace, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null When trying to deserialize some data in another program than the program I serialized it with. After some googling I've found out that apparently this can only be done using ...

Serializing Data Transfer Objects in .NET

I have a set of data transfer objects (e.g. a lot of reqest, response message classes, like MainRequest, MainResponse, ShutDownRequest, ShutDownResponse) Where new classes keep coming as the project evolves. These classes must be (de)serialized from and to various XML formats with different public XSDs. New XML formats come as the projec...

Storing Objects in columns using Hibernate JPA

Is it possible to store something like the following using only one table? Right now, what hibernate will do is create two tables, one for Families and one for people. I would like for the familymembers object to be serialized into the column in the database. @Entity(name = "family") class Family{ private final List<Person> famil...

How do you get System.Web.Script.javascriptSerializer to ignore a property?

[Serializable] public class ModelResource:ISerializable { public Int64 Ore { get; private set; } public Int64 Crystal { get; private set; } public Int64 Hydrogen { get; private set; } //needs to be ignored public Int64 Total { get { return Ore + Hydrogen + Crystal; } } public string ResourceType { get; private set; } ...

Silverlight WCF service consuming inherited types in datacontract

Hi, Im trying to consume a WCF service in silverlight... What I have done is to create two seperate assemblies for my datacontracts... Assembly that contains all of my types marked with data contracts build against .Net 3.5 A Silverlight assembly which links to files in the 1st assembly. This means my .Net app can reference assembl...

Is it possible to automatically serialize a C++ object?

Is there something similar to Java/.NET serialization for C++? ...

When does it make sense for a Java object to be Serializable but not Cloneable?

If a Java class implements the Serializable interface but does not have a public clone() method, it is usually possible to create a deep copy like this: class CloneHelper { @SuppressWarnings("unchecked") public static <T extends Serializable> T clone(T obj) { try { ByteArrayOutputStream baos = new ByteArrayOu...

How does Linq-to-Xml convert objects to strings?

Linq-to-Xml contains lots of methods that allow you to add arbitrary objects to an xml tree. These objects are converted to strings by some means, but I can't seem to find the specification of how this occurs. The conversion I'm referring to is mentioned (but not specified) in MSDN. I happen to need this for javascript interop, but th...

Avoiding serialization in distributed EHCache

Is there a way to not use serialization and still use the EHCache disktore. I have nested objects , which are not serializable, which have to cached in a distributed ehcache. I can use JMS, to avoid serialization, and still achieve cache replication. But is there a way to avoid serialization to use the diskstore as well? Why isn't there...

Sending large serialized objects over sockets is failing only when trying to grow the byte Array, but ok when using a massive byte array

I have code where I am trying to grow the byte array while receiving the data over my socket. This is erroring out. public bool ReceiveObject2(ref Object objRec, ref string sErrMsg) { try { byte[] buffer = new byte[1024]; byte[] byArrAll = new byte[0]; bool bAllBytesRead = fals...