serialization

Problem deserializing Serializable ArrayList of Overlays

Hello, i been having problem... first of this is for android. I have created a Serializable ArrayList<E> class that extends ArrayList<E> and implements Serializable. This class works flawlessly when saving and loading ArrayList<String>. Now i am trying to save and reload a SerializableArrayList<Overlay>. at first i couldn't save the ...

android how to serialize a class and save it somewhere with a name or tag ?

Hi, Anybody can explain me how to serialize easly a class/object and save it under a name or tag for restoring later ? thanks to give code examples if possible. ...

Serializing a Struct

UPDATE The problem is no longer in the struct itself, but in my GetSerializerFor(Type typeOfT) method shown below Original Question I have the following struct that serializes to <Base64String><string>valuehere</string></Base64String> I want it to serialize to simply <string>valuehere</string> But I can't get it to work, I have...

Json issue in a sub-class

I have 2 DTO files, with one of them being a sub-class of the other. The fields on the super-class are as follows: [JsonProperty] protected int financialFormatHeaderID; [JsonProperty] protected string financialFormatHeaderCode; [JsonProperty] protected string description = string.Empty; [JsonProperty] protected FinancialFormatPurpose...

Control object creation during deserialization

I would like to control object creation of a type that is not usually serializable during deserialization using a NetDataContractSerializer (or any serializer I guess). Using a custom SerializationBinder I can control the type that is constructed and using a custom ISurrogateSelector and ISerializationSurrogate to control how state is se...

Serialize Composed Func?

This works fine: Func<string, string> func1 = s => s + "func"; ViewState["function"] = func1; However, this does not: Func<string, string> func1 = s => s + "func"; Func<string, string> func2 = s => func1(s); ViewState["function"] = func2; It throws a runtime serialization exception: Type 'MyProjectName._Default...

Am I serializing/deserializing correctly?

For some reason when I deserialize my quotes ArrayList, I don't get the right object back. I want to make sure that whenever I read/write my object, it will always be the same object. Serialization code: private void serializeQuotes(){ FileOutputStream fos; try { fos = openFileOutput(Constants.FILENAME, Cont...

How to contribute to Rails?

I ran into a problem with ActiveRecord serialization. Apparently, it has trouble serializing hashes where ranges are keys. I found the Rails Lighthouse ticket (https://rails.lighthouseapp.com/projects/8994/tickets/3067-activerecord-cant-deserialize-hashes-with-range-keys). I've never contributed to an open-source project before, and this...

how to serialize manually a class ?

Hi, I want to serialize my class. I have this code : public class Video implements Serializable{ public long videoId; public String title; public String publisher; public String language; public Date lastModified; public Date published; public String imageUrl; public String url; public Bitmap myVideoScreenshotBm; //public Drawable myVid...

Speeding up java deep copy operations

We have implemented a general purpose deep copy mechanism using serialization. import java.io.*; public class CopyUtil { public static Object clone(Object source) { Object retVal = null; try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutput...

How to decide at runtime which type to pass as a generic parameter?

I have several message queues that have specific messages on them. I've created classes for these messages using xsd.exe. I can receive a message syncronously and deseriazlise it with this method: public oneOfMyTypes DeserializeMessage(XDocument message) { var serializer = new XmlSerializer(typeof(oneOfMyTypes)); var entity = (oneOfMy...

android how to save a bitmap - buggy code...

Hi, Im trying to serialize a class in wich i have a bitmap variable. Here is the code that is a bit working.... I need help to find out what is still wrong..... private Bitmap myVideoScreenshotBm; private void writeObject(ObjectOutputStream out) throws IOException{ out.writeInt(myVideoScreenshotBm.getRowBytes()); out.writeInt(...

how can I replace the deprecated SoapFormatter?

I have a legacy app that uses SoapFormatter to persist a graph of objects (maybe 50 different classes). I want to move away from using this as it is deprecated, and increasingly hard to continue to support deserializing from old files as the classes change. I want to use DataContractSerializer going forward. Does anyone have any suggest...

Writing an class/struct that changes frequently

Summary: I have a struct that is read/written to file. This struct changes frequently, and this causes my read() function to get complex. I need to find a good way to handle change while keeping the bug count low. Optimally, code should be make it easy for one to spot the changes between versions. I have thought through a couple of pa...

boost.serialization and replace existing method of serializing std::wstring

Hi! I need to serialize std::wstring by my own method. How to force boost to use my methods of serialization instead of default methods? Thanks. ...

Can't deserialize an array of objects from JSON into a C# object

I'm having trouble getting the JavascriptSerializer to deserialize an array of objects. I'm not terribly sure what I'm missing. Here's my object... public class HomefinderResult { public Data data; public List<Listing> listings; public Status status; public class Listing { public string recordingDate; ...

Serialization bugs in .NET?

I'm reading up on serialization, and have so far been messing with BinaryFormatter and SoapFormatter. So far, so good - and everything have both Serialized and Deserialized perfectly. However, when I try the code below, I would expect my datafile to NOT contains the info for Name - and it does. Why would it contain that, when I specify ...

fastest c++ serialization?

Good morning all, I'm searching for a very fast binary serialization technique for c++. I only need to serialize data contained in objects (no pointers etc.). I'd like it to be as fast as possible. If it's specific to x86 hardware that's acceptable. I'm familiar with the C methods of doing this. As a test I've bench marked a couple of ...

ASP.NET MVC: How can I serialized data from instance of classes generated by Linq2Sql?

Hello, I've learned to create multi-steps application from the Steve Sanderson's book (Pro ASP.Net MVC/APress p.477). Since then, I've adapted that Technique to many scenarios. Basically, it's about serialization/deserialization to keep data live between requests. But the only problem is I cannot use model generated by Linq2Sql becaus...

Marshal by bleed/reference/value?

Hi, I have heard about marshal by reference, marshal by bleed and marshal by value. What exactly are the differences between these 3? I know that these are used when transporting data across appdomains/serialization but not much more. Thanks ...