Questions tagged [binary-serialization]

The process of translating data structures or object state into a binary format

Serialization can be defined as the process of storing the state of an object to a storage medium. During this process, the public and private fields of the object and the name of the class, including the assembly containing the class, are converted to a stream of bytes, which is then written to a data stream. When the object is subsequently deserialized, an exact clone of the original object is created.

http://en.wikipedia.org/wiki/Serialization
http://msdn.microsoft.com/en-us/library/72hyey7b(v=vs.110).aspx

178 questions
3
votes
1 answer

Binary Serialization Using Boost and uint8_t

When working with binary data I tend to use uint8_t. I guess that just seems like the type of a byte to me. However, I can't figure out how to get the binary serialization in boost to work with that type. Am I asking the impossible or just missing…
3
votes
1 answer

Deserialize an object without it's type

Is there a way to view the metadata and property information for a serialized object without knowing what it serializes to? I have a bunch of binary serialized objects and need to data mine but I don't have access to the original classes. Now, it's…
Jake
  • 733
  • 8
  • 23
3
votes
1 answer

Binary serialization and automatic properties

I have a class like this: public class Foo { public IBar {get;set;} //tons of other properties } public interface IBar { //whatever } The class is used for binary serialization (standard use of BinaryFormatter). An implementation of…
dzendras
  • 4,721
  • 1
  • 25
  • 20
3
votes
3 answers

Java partial (de)serialization of objects

Let's say we have 3 Classes: class foo { // not a singleton String s; } class bar { foo f; int i; } class baz { foo sameF; } Now we create instances foo onlyFoo = new foo("the only one"); bar theBar = new bar(onlyFoo, 123); baz…
user1563700
3
votes
2 answers

C# Serialization practices of object with custom types

I've created some custom types for example: public class Temperature { protected double _celcius; public Temperature(){} public Temperature(double celcius) { _celcius = celcius; } public double Celcius { …
dav_i
  • 27,509
  • 17
  • 104
  • 136
2
votes
1 answer

How to minimize serialized data - binary serialization has huge overhead

I'd like to reduce the message size when sending serialized integer over the network. In the below section buff.Length is 256 - to great an overhead to be efficient! How it can be reduced to the minimum (4 bytes + minimum overhead)? int…
KostaZ
  • 710
  • 1
  • 7
  • 17
2
votes
0 answers

Explicit BinaryFormatter serialization when Constructor is not called

Some background about my problem: I have a lot of classes that implement ISerializable and are designed to be serialized using the explicit BinaryFormatter methods: .ctor(SerializationInfo info, StreamingContext context) and void…
Nathan
  • 1,675
  • 17
  • 25
2
votes
3 answers

Serialization in .NET

My task was to serialize and deserialize an object. I want to know: Whether my object is serialized in the way I'm doing it How I get to know that my object is being serialized or deserialized Instead of passing the object in the Serialize…
Abid Ali
  • 1,731
  • 8
  • 26
  • 62
2
votes
2 answers

boost::archive::binary_(i/o)archive portability

Is a boost binary archive "portable" from one Linux x86_64 machine to another Linux x86_64 machine? The documentation suggests it is, by using the term native binary, however, I have not yet been able to do it. Is it "my fault", or is such a thing…
idefixs
  • 712
  • 1
  • 4
  • 14
2
votes
2 answers

Java: Foreign Memory "VarHandleSegmentViewBase" error, Misaligned Access at Address

I'm trying to understand how to read/write binary encoded versions of a simple struct, like below: typedef struct Tuple { uint32_t length; uint8_t* data; } Tuple; I have the following code, which can correctly write a Tuple record in Java…
Gavin Ray
  • 595
  • 1
  • 3
  • 10
2
votes
1 answer

writing struct to .txt file

I'm trying to store my struct into txt file using boost but unable to do it. I'm using boost library. example structure struct Frame { uint32_t address{ 0 }; uint16_t marks{ 0 }; uint16_t age{ 0 }; char gender{ 'M' }; std::string…
Rav
  • 75
  • 9
2
votes
0 answers

SerializationException Unable to find assembly

I need to know if is possible serialize an object of type AssemblyA.MyType and deserialize the file to type AssemblyB.MyType. These two types are identicals, the only difference is the location that it's stored(AssemblyA and AssemblyB). My…
Lucas
  • 21
  • 2
2
votes
3 answers

Binary serialization in C# (really, WYSIWYG serialization)

(for WYSIWYG I mean that I decide WHAT is written and HOW it's written, and not someone at Microsoft or at Google) (OK... Technically I don't decide anything... Someone that programmed some years ago decided, and I can only ask how much high I have…
xanatos
  • 109,618
  • 12
  • 197
  • 280
2
votes
1 answer

C# Serialize class into byte[] that is not marked as Serializable

I have classes like below and which I cannot change since these are almost 20+ years old classes and they are already in production used by many applications. This is maintained by a team and before I go to them and ask to make change which I feel…
Ziggler
  • 3,361
  • 3
  • 43
  • 61
2
votes
1 answer

C++ protobuf how to set values for nested struct

I am learning C++ ProtoBuf. I have the following struct which I need to serialize: enum phonetype { DESKPHONE, MOBILE, WIRELESSPHONE }; struct phonenumber { int ptype; string number; }; struct address { string addr1; …