joshivineet / protobuf

Automatically exported from code.google.com/p/protobuf
Other
0 stars 0 forks source link

ByteString should be Serializable #485

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'm aware that java serialization isn't perfect, and that it has many problems.

That being said, there are many frameworks and places in the java world that 
use Serializable as the default serialization that's always there. (In the 
example that bit us, akka, a scala framework for actor-based distributed 
computing, uses java serialization as its default serialization format)

ByteString is a very useful data abstraction (like String, but for bytes) and 
it's the kind of thing you end up with lots of when you're building something 
that takes protobuf-formatted messages off the wire from remote clients and 
then does local processing inside an akka framework.

It'd be really useful then if ByteString were serializable by java 
serialization and it's a small change.

Patch attached that does simple java serialization by serializing ByteStrings 
that need to be serialized as LiteralByteString instances.

Original issue reported on code.google.com by fiz...@gmail.com on 18 Mar 2013 at 2:34

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by xiaof...@google.com on 18 Mar 2013 at 4:47

GoogleCodeExporter commented 9 years ago
Obviously in the patch I meant the exception text to read "not to be 
serialized" instead of the nonsensical "not to serialized".

Original comment by fiz...@gmail.com on 21 Mar 2013 at 5:58

GoogleCodeExporter commented 9 years ago
Alongside serialization...
The internal usage of RopeByteString (and RopeInputStream) is particularly 
interesting. It would be very handy if ByteString exposed a public method for 
chunking a ByteString into several smaller chunks. Something along the lines of:

public static List<ByteString> chunk(ByteString s, int maxChunkSize);

Original comment by vi...@umich.edu on 15 Jan 2014 at 11:05

GoogleCodeExporter commented 9 years ago
Hi fizbin,

Thanks for providing the patch.

Can you submit the patch to our new github site:
https://github.com/google/protobuf/pulls

and sign this Google CLA?
https://developers.google.com/open-source/cla/individual?csw=1

Original comment by xiaof...@google.com on 8 Oct 2014 at 1:06