Thanks a lot Feng :)

On Thursday, April 20, 2017 at 6:38:12 AM UTC+5:30, Feng Xiao wrote:
>
>
>
> On Wed, Apr 19, 2017 at 1:26 PM, Rohan Suri <[email protected] 
> <javascript:>> wrote:
>
>> You create a descriptor by using --descriptor_set_out right?
>>
> That's right. You can make that part of your build process and embed the 
> generated data file into your binary however you want.
>  
>
>> Followed by creating FileDescriptorProto by using 
>> parseFrom(FileInputStream)? 
>>
>
>> And moving forward as stated here 
>> https://groups.google.com/d/msg/protobuf/bWlJaaMmx4Q/kIYJ1-5YRb0J
>>
>>
>> On Wednesday, April 19, 2017 at 11:43:42 PM UTC+5:30, Feng Xiao wrote:
>>>
>>> CodedInputStream is the right one to use for 1.
>>>
>>> Invoking protoc compiler in production sounds problematic to me, though 
>>> I'm not aware of any document listing it explicitly as bad practice. I 
>>> would suggest avoid that and use other alternatives. For example, in Google 
>>> we build a protodb which contains FileDescriptorProto of all transitively 
>>> depended .proto files and use that instead of actual .proto files.
>>>
>>> On Wed, Apr 19, 2017 at 10:39 AM Rohan Suri <[email protected]> wrote:
>>>
>>>> Hey Feng, thanks for your input.
>>>>
>>>> Any suggestions for 1) ? Other than using CodingInputStream?
>>>>
>>>> Also is it bad practise to invoke protoc compiler in a production 
>>>> environment?
>>>>
>>>> On Wednesday, April 19, 2017 at 11:00:17 PM UTC+5:30, Feng Xiao wrote:
>>>>>
>>>>>
>>>>>
>>>>> On Wed, Apr 19, 2017 at 4:20 AM, Rohan Suri <[email protected]> 
>>>>> wrote:
>>>>>
>>>>>> Hello everyone,
>>>>>>
>>>>>> I'm trying to find the right Java APIs to do what protoc --decode_raw 
>>>>>> and protoc --decode do.
>>>>>> Essentially handling two cases:
>>>>>> 1) When I don't have the proto, and only the raw protobuf msg.
>>>>>> eg protoc --decode_raw < rawmsg.bin
>>>>>>
>>>>>> 1: "rohan"
>>>>>> 2 {
>>>>>>     1: "13"
>>>>>>     2: "08"
>>>>>>     3: "94"
>>>>>> }
>>>>>>
>>>>>> 2) When I have the .proto(not the generated classes, neither the 
>>>>>> parsed .proto)
>>>>>> eg protoc --decode some.pkg.name.Person $proto_file_path < rawmsg.bin
>>>>>>
>>>>>> name: "rohan"
>>>>>> dob {
>>>>>>      dd: "13"
>>>>>>      mm: "08"
>>>>>>      yy: "94"
>>>>>> }
>>>>>>
>>>>>> I did dig google groups.
>>>>>>
>>>>>> From those the hints I've got is
>>>>>> For case 1) Using CodedInputStream write my own parser? parsing bytes 
>>>>>> by making informed guesses.
>>>>>>
>>>>>>
>>>>>> https://groups.google.com/forum/#!searchin/protobuf/decode$20without$20proto|sort:relevance/protobuf/7s4YIwrQLgk/r2Yc_36OYGAJ
>>>>>>
>>>>>> http://stackoverflow.com/questions/19647387/parsing-a-raw-protocol-buffer-byte-stream-in-c-sharp/19652735#19652735
>>>>>>
>>>>>> http://stackoverflow.com/questions/13937882/parsing-protocol-buffers-without-knowing-the-proto
>>>>>>
>>>>>> For case 2) well nothing. Everything I got assumed I have 
>>>>>> FileDescriptorProto for my .proto or instance of my message type.
>>>>>>
>>>>>
>>>>> 2) requires parsing .proto files and that parser is in C++ only. 
>>>>>
>>>>
>>>>>> Are there any add-on libraries present to handle these scenarios?
>>>>>> Or any logic to go about solving them?
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>>
>>>>>> -- 
>>>>>> You received this message because you are subscribed to the Google 
>>>>>> Groups "Protocol Buffers" group.
>>>>>>
>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>>> an email to [email protected].
>>>>>> To post to this group, send email to [email protected].
>>>>>
>>>>>
>>>>>> Visit this group at https://groups.google.com/group/protobuf.
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Protocol Buffers" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to [email protected].
>>>> To post to this group, send email to [email protected].
>>>> Visit this group at https://groups.google.com/group/protobuf.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Protocol Buffers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/protobuf.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to