Boost logo

Boost Users :

Subject: Re: [Boost-users] Serialization TextArchive are Cross-Language?
From: Robert Ramey (ramey_at_[hidden])
Date: 2011-06-09 15:33:30

Marco Piacentini wrote:
> Hy...I try to explain better my question...
> Im using boost serialization text archive before sending data over
> TCP connection...
> Now I need to pass the received data to a Java I
> would know if the serialized stream is composed only by the data or
> by the data + boost serialization(tag, code, etc.)...
> In this case my only chance to transfer the data to the java
> application, is to filter them before transfering?thanks...

I'll try to answer the question - but I'm sort of speculating as to what
you want to do. I throw in some miscellanous observations which
may or may not be helpful.

a) Generally I don't suggest that one tries to use boost serialization
to export data to non C++ applications. The library is intended to
provide the easiest to use and most efficient implementation of
serialization for C++ environments. Any ability to use this to
export data to/from other environments is a coincidence.

b) There are other tools for accomplishing the above. There
is google protocol buffers and there is boost spirit/karma/qi
which handle data in a way that is not connected to C++. Of
course they won't be as automatic as serialization for just this

c) Never the less, some people have been able to do this. In
large part it consists of not using those parts of the library which
are strongly dependent C++ such as serialization of pointers. A
useful place to start is one of the examples included with the package
 which creates a write only archive which can export any data which
includes serialization functions. The leverages the serialization functions
to save a lot of work at the expense of being to read the archive back.
Something like might work for you.

d) there are other examples around for serializing files with JSON
and YAML formats. Again, these would likely mean not using
some of the features of the serialization library - which might be
be fine for you app.

I realize this might not be much comfort - but hope it helps

Robert Ramey

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at