telenths / protostuff

Automatically exported from code.google.com/p/protostuff
Apache License 2.0
0 stars 0 forks source link

Is there a way to jump to a field using ByteArrayInput? #74

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
My runtime schema has 30 fields. In some cases I read only the first 3 fields 
from the encoded byte[]. 

1) Is there a way to read just the just 3 fields and stop reading after that? I 
suppose if I use a hand rolled schema I can...correct?

2) Also how would I read field number 3, 7 and 19 or some such random positions?

3) If I store only ints, does it automatically get encoded as variable ints? In 
that case will the field ordering and the positions change?

Ashwin.

Original issue reported on code.google.com by ashwin.j...@gmail.com on 15 Jul 2011 at 8:42

GoogleCodeExporter commented 8 years ago
Hi Ashwin,

For discussion/support, the best way to do it is via google groups.
I'd appreciate it if you ask your questions there next time.

1.  Use a hand-coded/genereated schema with the 3 exact field numbers/types.
2.  Do #1.  It will skip all fields except 3,7 and 19.
3.  Yes.  Ints translate to var ints.  The field ordering will not change.  
Plus you are only reading data.

#1 acts as a view/filter for your pojos.

Original comment by david.yu...@gmail.com on 16 Jul 2011 at 12:31