Questions tagged [serialization]

Serialization is the process by which an object is converted into a format that can be stored and later retrieved.

Filter by
Sorted by
Tagged with
10
votes
1answer
4k views

Inspector interface serializer

I've written some code that allows Unity3D's inspector to display fields that conform to an interface. Unity has some quirks about their inspector, so as a preface they are listed here: If you add a <...
3
votes
1answer
173 views

Recursive reading of a UI configuration file

In our project (Windows app, Winforms), the UI is designed based on XML configuration file. I have a program to read the UI configuration file and Parse the configuration and design the UI. The ...
4
votes
2answers
161 views

Serializing data from two URLs in the same object efficiently

This is a follow-up to: Serializing JSON data coming from two URLs in the same object I have two URLs (urlA and urlB) and they ...
10
votes
4answers
6k views

Persistent cookie support using Volley and HttpUrlConnection

I need to add support for persistent cookies on an Android app that I'm building for Authentication/Authorization. This app uses Volley for making HTTP requests and its ...
6
votes
1answer
1k views

Parsing Valve Key-Value files

Introduction Valve recently launched the Dota 2 Workshop Tools, which allows players to create their own maps with custom gamemodes, similar to Warcraft 3 in capabilities. Ability and unit ...
7
votes
3answers
4k views

Converting a boolean list to string, and vice versa

I am currently using this to convert a List of booleans to a string ...
1
vote
1answer
149 views

Should this container be a struct or a class?

I have a class that serves purely as a data container for passing values from a parsing class to a class responsible for saving the data. I have been wondering whether it would be more appropriate as ...
3
votes
0answers
319 views

Functionally Typed I/O Streams

I thought up a function that provides types with InputStream and OutputStream: ...
3
votes
1answer
47 views

Separation of code into functions and use of patern matching in Haskell

In the following: ...
5
votes
1answer
52 views

Robust organization data class (partial followup)

This question is a partial followup from my previous question, however the requirements have changed: I now need to be able to store multiple data entries for some fields. I also have added two hooks ...
2
votes
2answers
1k views

Updating XML config files

I have been unable to find any other way to update a user config file than the following method. ...
10
votes
1answer
15k views

Type-length-value (TLV) encode/decode

I wrote these methods to encode data as array of TLV objects, and also to serialize and deserialize them. Any feedback on improvements, etc. would be appreciated. Please note that I ignored ...
5
votes
3answers
3k views

Reading and writing binary data in C++

I have written a small container class which groups a 3D position, a normal vector and a texture coordinate into one object. It uses the glm library for the actual data types (vec2 and vec3). This ...
7
votes
1answer
753 views

Save Games on iOS with NSCoding

This is the second time I have implemented saving and loading for a game using Objective-C. I am using the built in NSCoding methods. I would love to hear opinions about NSCoding and whether or not ...
10
votes
1answer
226 views

Organization data class

I believe I have made the following data class quite decently, and I'd like a thorough review on it. The code is built on Java 8 and uses the Builder and Serialization Proxy pattern, it is used to ...
4
votes
1answer
529 views

How could I reduce repetition with properties/methods?

I'm serializing instances of a lot of classes (in C# 3.0), and I've found myself writing this: ...
5
votes
2answers
4k views

ASN.1 BER Encoding and Decoding

I have a project (ldaplib) I am working on that needs to do ASN1-BER decoding and encoding. The function I have for the decoding portion is slightly more complex but neither are all that complicated. ...
5
votes
1answer
6k views

Helper class to change property of string when serializing for Json.Net

Is there any way to simplify the following C# helper class to numerate a string for Json.Net? ...
7
votes
1answer
1k views

Python compress and send

The following two functions are used to compress arbitrary Python objects and send them safely via socket or email, using only printable chars. In my specific message protocol, '=' signs are also not ...
3
votes
1answer
235 views

Serializing tabular data in ruby — is map, flatten, hash the correct approach?

I wanted a hash which lets me reference Japanese syllables by their romanized names. In hindsight I could have searched for an existing one column table, but I wanted to improve my ruby by writing a ...
3
votes
3answers
613 views

Forcing type-safe IDs for use with Collections and Maps

Introduction I have a hierarchically nested tree class (like SampleFolder, s.b.) that I want to serialize. The problem arises with the collection of sub items ...
7
votes
1answer
25k views

Parse strings and convert the value to .java types

Below is a generic code for parsing strings (read from file for example) and converting them to .java types, such as primitives (and their wrappers), java.io.File, Enum etc. There is also possible to ...
1
vote
2answers
3k views

Serializing/deserializing binary tree in most space-efficient way

I'm looking for corrections, optimizations, general code review, etc. ...
5
votes
1answer
202 views

Classes to serialize departments and their employees

I have many small but similar classes like these: ...
3
votes
1answer
2k views

best way to write series of objects to a .ser file using ObjectOutputStream and read them back [closed]

I create series of objects out of Student Class and store them in a vector. I write each object in to a .ser file once it created. Then I read them back. My code is working perfectly. What I want to ...
0
votes
1answer
738 views

Generating redundant data for Google Maps markers

I'm a mediocre programmer at best and am pretty terrible at JavaScript. But I have been tasked with creating a Google Maps application. This application is driven by a dynamic report with a Java layer ...
4
votes
1answer
10k views

Writing integer to binary file

I wrote a python function that writes a integer to a file in binary form. But are there any ways that I can reduce the number of steps, is there a more efficient way to write a integer to a file? <...
2
votes
1answer
90 views

Is this the only or best method for classes serializing in Java?

I usually use the static methods from this designed class in order to perform objects serializing of custom classes. Even though I'm getting good results, I wonder if this is the most appropriate way ...
3
votes
2answers
7k views

Deserializing a byte array from Java in C++

I am writing a byte array value into a file, consisting of up to three of these arrays, using Java with big Endian byte order format. Now I need to read that file from a C++ program. ...
6
votes
1answer
2k views

Parallel Job Consumer using TPL

I need to provide a service (either a Windows Service or an Azure Worker Role) which will handle the parallel execution of jobs. These jobs could be anything from importing data to compiling of ...
8
votes
1answer
586 views

Improve this reflection bashing code

I have implemented an IDataContractSurrogate to enable serialization of ImmutableList<T> (from the Microsoft Immutable ...
1
vote
1answer
885 views

Serialize the properties of an entity framework entity to data fields and back

I am trying to write code to convert properties of an Entity Framework entity to strings and back. Here is the code so far that converts back from strings to the object properties. I am stuck trying ...
5
votes
3answers
29k views

Simple address book in Java

I've answered the following question as best as I could, but I need some help with my design and am wondering if I've taken the correct approach. I would appreciate it if anyone could please point ...
6
votes
1answer
4k views

Capturing and taking a screenshot of a window in a loop

I am capturing a window of my own choice, and taking a screenshot of it constantly in a loop. Latency and speed is everything. It's very capable, but I hope it can be improved. ...
1
vote
1answer
73 views

Action to transmit queued messages over a socket

I have this action and it works but looks rather clunky to me. Is there any way I could improve that? ...
1
vote
1answer
116 views

Iterating over two iterables

I've written a little function that iterates over two iterables. The first one returns an object which is used to convert an object of the second iterable. I've got a working implementation, but would ...
1
vote
1answer
623 views

Reading BER-encoded data

I'm trying to read some SNMP packets on my own. So far so good, I was able to put up some functions to write some SNMP TRAP packets as I need them. However, now I need to be able to read them and ...
1
vote
1answer
5k views

Write and read non-serializable object to file android example

I couldn't find a good example, so after some fighting with writing non-serializable object to file in Android, I decided to show you my solution. Could you tell me if it is OK or how could it be ...
6
votes
2answers
11k views

Spring autowiring in managed beans with support for serialization - is this safe?

Im trying to solve two problems I see with JSF2 and Spring. First @Autowired in @ManagedBean does not work Nor does ...
3
votes
1answer
615 views

Object serializer

I have this little utility/helper which serializes a form into a javaScript object. ...
6
votes
2answers
5k views

std::vector memory manipulation with serialization and deserialization

This is my code and I would like to get it code reviewed. It is functional and behaves as expected. I pass some basic types to the Serialize() function and then ...
11
votes
2answers
2k views

NewtonSoft Json.Net serialiser

I'm just starting to develop more in C# after being mainly a VB.NET developer and was looking for someone to critique my implementation of a NewtonSoft Json.Net serialiser. Can you provide some ...
9
votes
2answers
19k views

Effectively convert little endian byte slice to int32

I have a data stream of bytes and I'd like to get a little endian encoded int32 from four bytes. Is there a better way than to do this like the following code? ...
6
votes
1answer
451 views

Basis of custom C++ serialization lib

I know it's been done a million times already, but I couldn't find a serialization library to suit my needs. This is the very basis of what I came up with. I know the code is ugly and unstructured, so ...
31
votes
1answer
6k views

JSON Serializer

Carrying on from: Yet another C++ Json Parser Yet another C++ Json Parser (Recursive) All the code is available from git hub: ThorsSerializer but only reviewing a small section here. The idea is ...
8
votes
3answers
12k views

Serialize C# objects of unknown type to bytes using generics

Usage example var qm = new QueueMessage("foo", 99); var ba = ByteArraySerializer<QueueMessage>.Serialize(qm)); Class that performs the serialization / ...
4
votes
3answers
1k views

Converter for deserializing JSON

I'm writing a custom JavaScript converter to deserialize some JSON. Here's a few lines I'm writing: ...
5
votes
4answers
1k views

Persist data by serializing/deserializing objects that are sent to it

I've created the following class to persist data by serializing/deserializing objects that are sent to it. I would like to know if there is a better way of writing this class, or if my class is fine ...
5
votes
1answer
1k views

Reading a binary file containing periodic samples

I have the following code for reading HTK feature files. The code below is working completely correct (verified it with unit tests and the output of the original HTK toolkit). ...
8
votes
1answer
257 views

Interpolating given value and legacy value from serialization buffer

Here's a function that interpolates between a given value and a value fetched out of a legacy serialization buffer: ...