On Wed, Jan 27, 2010 at 9:05 PM, Michael Poole <mdpo...@troilus.org> wrote:
> If you serialize the elements inside the Bag to the disk individually, > you could prefix them with a synchronizing marker and length. A marker > would typically be a fixed-length pattern that is unlikely to appear in > legitimate data -- starting with a zero byte is a good way given > Protocol Buffers data, it should contain some other (ideally uncommon) > bytes for robustness. > I'd add that the marker should also contain some sort of checksum, e.g. CRC. Otherwise, you might not detect corruption when it happens. It's very easy for a corrupt message to still appear to parse correctly. In an environment where corruption is a concern, you definitely want to verify all data to make sure you don't accidentally start using garbage! -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.