You could write our own decoder around CodedInputStream, manually reading
and skipping the messages that you don't care about. The other option is to
use an equivalent message definition

message XAsBytes {
  repeated bytes y = 1;
}

And then manually decode the entry you want into Y.

On Thu, Oct 6, 2011 at 6:11 AM, Michael Bartel <mbartel...@googlemail.com>wrote:

> I have a lot of data and need PBF just to extract the things i want
> from it, and not everything at once. I am getting the impression, that
> PBF is not suitable for that kind of needs, but I am pretty new to it,
> and maybe i'm overlooking something.
>
>
> I have for example:
>
> message x {
>  repeated Y y =1;
> }
>
> Now every object of type Y is pretty big and i just want to extract
> one single y from the disk and deserialize it.
>
> To be more clearly, i want something like: x.getY(int position), and i
> need Protobuf to just read that object from the disk and nothing else.
> From what i understand, if i use "parseFrom(String path)" to create an
> instance of x, every y in Y is parsed as well and that takes a lot of
> ram space, which i simply dont have.
>
> Thanks for any help!
>
> Michael
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@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.

Reply via email to