Questions tagged [serialization]
Serialization is the process by which an object is converted into a format that can be stored and later retrieved.
291
questions
0
votes
0
answers
33
views
Flat serialization of single-value Java records used as strong types with Gson v2.11.0
Introduction
I am currently developing a REST client in Java v21 and got the foundation basically working.
In my project the Immutables and Gson library are currently used. Both libraries integrate ...
5
votes
2
answers
555
views
Function templates for serializing/deserializing POD types
Are the two function templates below well-formed for serializing/deserializing POD types? Will they work for all the different types that satisfy the constraint pod?...
4
votes
1
answer
520
views
Lazily decode a buffer with a thread-safe Iterator
I have implemented an Iterator for my Pojo class.
The purpose here is to lazily decode multiple ...
0
votes
0
answers
84
views
custom serialization of an HttpSession-stored class to get it replicated between cluster nodes
As a part of guice-context-scopes library for building custom Guice Scopes, I have a class named InjectionContext (code below), that stores scoped objects in a <...
3
votes
1
answer
111
views
Type-safe number serialization-deserialization
I have written this code for serializing and deserializing integer and floating point numbers to/from vector/array of bytes. The aim of the code is to provide a simple interface to use, but make it as ...
2
votes
1
answer
135
views
Binary (de)serialization library for c++
A while ago I posted the code for this library I'm working on, and have refactored the code quite a bit ever since. I would appreciate any feedback in regards to what I have so far to see what can I ...
7
votes
2
answers
2k
views
Serialization and deserialization a doubly-linked list with a pointer to a random node in C++
I tried to serialize a doubly linked list. Can you rate it, and what could be improved?
I open the file with fopen(path, "wb") and write all data in ...
5
votes
2
answers
144
views
Integer endianness types for protocol structures, take 2
Motivation
When working with storage or wire protocols, we often read or write structures containing integers with specific byte-ordering (e.g. big-endian for Internet Protocol, or little-endian for ...
2
votes
1
answer
82
views
Integer endianness types for protocol structures
Motivation
When working with storage or wire protocols, we often read or write structures containing integers with specific byte-ordering (e.g. big-endian for Internet Protocol, or little-endian for ...
3
votes
2
answers
1k
views
Binary (de)serialization in c++
I'm trying to make a simple library for de/serialization in c++, but I know it can be tricky to implement, so I'd really like to have my code reviewed to see if there's anything that stands out and/or ...
4
votes
1
answer
397
views
Abstract base class for binary serialization
Ensuring that some logic is always being run before the user's overriding methods.
I'm writing a library and I have some abstract classes that can be binary serialized (and users can subclass them and ...
-2
votes
1
answer
543
views
How can I optimize C++ serialization? [closed]
I want to serialize a C++ class Ramdomclass . Below is the serialization function.
...
0
votes
1
answer
514
views
What can I do better in my C++ serialization implementation?
I want to serialize a class Mango recursively.
...
3
votes
1
answer
429
views
Portable integer to/from little endian conversion in C
Integers need to be converted to a byte array of defined endianness to be reliably and consistently saved and transmitted, and converted back to be accurately received and read. The goal is to be as ...
4
votes
1
answer
185
views
Python unit tests for storing and loading objects
I wrote some code and thought I may get better with some feedback. I program for almost 5 years, mainly in python.
I care most about the unit testing.
I am not really sure, how industry standard unit ...
2
votes
1
answer
368
views
Simple ID Generator
Task
Write a program that can generate and manage collections of IDs. The user should determine how long the IDs have to be and what symbols they are composed of.
Design choices made by me
The ...
4
votes
3
answers
260
views
C++ B-Tree serialization/deserialization
Yesterday I wrote a serialization/deserialization for my B-Tree library.
Since the code for whole tree is too large to upload here, I'll upload only serialization/deserialization and node class ...
-1
votes
1
answer
59
views
Packing several values into a byte buffer [closed]
I'm packing several values from a struct into a buffer to send them over Bluetooth.
I don't want to send the whole struct and I also don't want to deal with padding, so I'm copying just the values I ...
5
votes
2
answers
129
views
Class for serializing themes for my JavaFX application
I have a Theme class for storing themes for my javaFX application. I created a serialize method that stores its information as a String and a constructor to create a Theme from a serialized Theme. I ...
2
votes
3
answers
2k
views
Deserializing Nested JSON Data with variable rootName to C# Class
I am working with JSON API data in .NET6 and was having trouble de-serializing nested data that has a variable rootname since my class type will never match what's in the JSON string.
...
3
votes
1
answer
161
views
Processing a binary file with buffer length tags
I am trying to process a very large binary file using MappedByteBuffer from java.nio package.
This is how the data looks like in the file:
...
1
vote
1
answer
944
views
Jackson deserialization of subset of enums
I have several enums that all implement this interface:
public interface SelectOption {
String getId();
String getLabel();
}
Here's an example:
...
2
votes
1
answer
317
views
Multiplayer game byte array serializer with unity
I I'm trying to make an multiplayer game using golang and unity. Golang server side checking units on scene(like a character move). It also sends the information (position, health) of the units on ...
1
vote
0
answers
114
views
Python functions to serialize nested data structures human readably
See Serializing (nested) data structures in a human-readable format for more details.
In the last two days I have significantly improved my function, and wrote seven implementations of it.
I have ...
2
votes
2
answers
119
views
Serializing (nested) data structures in a human-readable format with all bugs fixed
See Serializing (nested) data structures in a human-readable format for more details.
This is the latest version, I have fixed all bugs and now this piece of code works completely as intended.
And I ...
4
votes
2
answers
1k
views
Serializing (nested) data structures in a human-readable format
I am reinventing the wheel to write a function that serializes a (nested) data structure human readably. The default output is deliberately similar to that of ...
6
votes
4
answers
1k
views
Packing and unpacking values in a buffer
I have to deal with raw memory manipulation. For that I wrote a function which stores data one after another, and another function which reads this data and stores it into variables.
More precisely:
<...
2
votes
1
answer
67
views
Wanted to eliminate the repetition in the classes created to reduce duplication
Can some one help me on how to eliminate repetition to reduce duplication score on the below classes created in the code
...
2
votes
1
answer
92
views
Android app class serialization
I am attempting to build an Android APP with the custom serializable class User. The public method Save is to save class ...
4
votes
3
answers
3k
views
De-/Serialization of structs representing TCP messages
I wrote two template functions to serialize and deserialize structs representing messages to be sent and received via a TCP socket:
...
8
votes
3
answers
527
views
Sinclair Spectrum TAP file dumper
The other day, I had occasion to want to look into an ancient piece of Z80 software written for a Sinclair Spectrum computer. Software for this machine was typically saved to audio tape, and today ...
1
vote
1
answer
408
views
Unity Static Singleton JSON Serialisation
I have a static PlayerData singleton which stores all the data for the player (gold, upgrades, heroes etc) but JsonUtility ...
4
votes
1
answer
2k
views
Struct Serialization using Unsafe Field
I want to use structs as a container for data packets for asynchronous networking in C#. Found out that you can create a union style struct without the need to mark the struct itself as unsafe--...
2
votes
2
answers
213
views
Message encode/decode library
I write protocol messages encoder/decoder for my project.
All messages have 2-bytes header (1 byte - message type, 1 byte message sub-type) and body.
There are two types of messages:
Plain message - ...
7
votes
2
answers
242
views
constexpr Precalculate size of serialized data with templates and C++20 concepts
Im writing a serializer that will do serialization/deserialization as fast as possible, and that uses templates so that i dont have to create a ton of functions for every data structure,
This is the ...
6
votes
2
answers
434
views
Simplify Generic Method
I am writing a GenericDeserializer for Apache Kafka. My class implements IDeserializer<T> from Confluent.Kafka.Net package....
5
votes
2
answers
250
views
(de)serializing c++ object almost automagically
Here's one way to solve the serialization problem in c++20, using a json library:
...
3
votes
1
answer
1k
views
JSON serializable string enum in C# with generic JsonConverter
How can StringEnumeration be changed in the code below into a generic class, so that ConsensusState wouldn't need the ...
6
votes
1
answer
674
views
Decoding a JSON dictionary into different Swift classes using Decodable and JSONDecoder
Generally, the approach I've taken is to try calling container.decode from a decodable enum with its associated value returning ...
1
vote
0
answers
884
views
Better way to Read /Write Memory<byte> to/from POCO
I am communicating with a machine that sends/received structured binary data to my netcore service. The machine supplier's new library uses Memory in their library's API.
I have written the following ...
2
votes
2
answers
1k
views
Reading and Storing Integer from Serial Monitor
Description
I wanted to understand how integers can be written and stored inside variables without the use of Serial.parseInt(). I couldn't find any code examples about this. Perhaps this is the ...
1
vote
1
answer
156
views
Traffic Light which revolves around Serial Communication
Assignment description
This is the improved code for a question I've posted earlier. I'd like to receive feedback on an assignment which I'm currently working on. I have to make two traffic lights ...
2
votes
1
answer
155
views
Feedback on Traffic Light which revolves around Serial Communication
Assignment description
I'd like to receive feedback on an assignment which I'm currently working on. I have to make two traffic lights which allow traffic to run smoothly. I'm using a master Arduino ...
1
vote
1
answer
249
views
Serializing object graph to proprietary binary file
I'm creating a class library to read/write .3di files which are binary files describing 3D models for a video game. This review is for the write/serialization process.
I've mapped the different ...
4
votes
1
answer
287
views
Convenience function to save and load pickle objects
I want to come up with a simple convenience function to save and load pickle objects. A secondary objective is to simply execute the function without the above function. I have come up with two ...
2
votes
2
answers
426
views
User Management Program
Main Goal
My goal is to create a chat app for my company (they are all software developers). I first make a console version and if it is working fine, I will make a GUI version. The program will run ...
3
votes
0
answers
1k
views
C# Rest Client Benchmarking
I build a C# Rest Client library / framework. I noticed that it seemed to be significantly faster than RestSharp for GET at least. So, I decided to put together some benchmarks comparing it to other ...
3
votes
0
answers
61
views
Getting a list of waypoints assuming that there is a map [closed]
I'm a beginner learning ROS. I'm developing an android application that will control my robot and that includes getting the list of waypoints to display it to my spinner. How do you get the list of ...
4
votes
1
answer
1k
views
Parse data into an array of structs
I'd had a hard time getting this to work. I’d like to parse a file containing data and copy this data into a struct.
The data file (test.dat) looks like this:
<...
4
votes
0
answers
430
views
F# XML Generation in .NET Core: XmlSerializer or XmlProvider
I am working on SEPA XML generator in F#.
I developed two solutions that are roughly equivalent, one relies on the XmlSerializer while the other relies on ...