[protobuf] Trying to rewrite a protobuf message but changing a couple of values

2023-09-20 Thread Joan Balagueró
Hello, I have a protobuf message like this into a byte array: 1: { // META element 1: 2 2: 1 3: 1 4: {// CutOffTime element within META 1: 10 2: 3 } 5: 1 6:

[protobuf] Re: Trying to rewrite a protobuf message but changing a couple of values

2023-09-20 Thread Joan Balagueró
> > > > On Wednesday, September 20, 2023 at 10:19:07 AM UTC+2 Joan Balagueró wrote: > >> Hello, >> >> I have a protobuf message like this into a byte array: >> >> 1: { // META element >> 1: 2 >>

[protobuf] Re: Trying to rewrite a protobuf message but changing a couple of values

2023-09-20 Thread Joan Balagueró
t; byte[] output = append(unmodifiedInputBytes, delta.toByteArray()); > > If the server expects a length delimiter you'd need to update it to the > new combined length. > > - Florian > > On Wednesday, September 20, 2023 at 11:03:46 AM UTC+2 Joan Balagueró wrote: > >>

[protobuf] Re: Trying to rewrite a protobuf message but changing a couple of values

2023-09-20 Thread Joan Balagueró
#compiling-protocol-buffers > > Don't mess with the reflection API if you can avoid it. > > > On Wednesday, September 20, 2023 at 12:19:38 PM UTC+2 Joan Balagueró wrote: > >> Hi Florian, >> >> Not sure what I can do with this code. I only have a byte array >

[protobuf] Missing field converting proto message from byte[] to "com.google.protobuf.Message"

2023-03-27 Thread Joan Balagueró
Hello everyone, I'm absolutely new to probuf. So this is my issue. We have implemented a proxy that receives a protobuf message as a byte array in a post message, and we only have to bypass this proto to the backend, receive the response (also in protobuf) and return it to the origin. That

[protobuf] Re: Streaming protobuf

2023-05-09 Thread Joan Balagueró
insField(CodedInputStream input, int fieldNumber) > throws IOException { > while (!input.isAtEnd()) { > int tag = input.readTag(); > if (WireFormat.getTagFieldNumber(tag) == fieldNumber) { > return true; > } > input.skipField(tag); > } > return false; > } >

[protobuf] Streaming protobuf

2023-05-09 Thread Joan Balagueró
Hello, I'm receiving protobuf messages from a client (I can't modify them in any way) with a list of hotels. There are hotels in the 90% of the times, but I need to differentitate when I receive hotels and when not. The proto file for "no hotels" is something like below (simplified): 1: { 1:

[protobuf] Split 1 protobuf into N protobufs

2024-02-29 Thread Joan Balagueró
Hello, I'm new in protobuf, and I was wondering if the following is possible. I have a protobuf response coming from an api that contains a list of hotels. If we imagine this response in xml, it would be something as follows: H1H2 I need to split this into 2 pieces: H1 H2 Is it possible to

[protobuf] Best solution to merge ByteStrings

2024-04-12 Thread Joan Balagueró
Hello, I have a protobuf like this in a ByteString variable 'cp': 1: { 1: 30 2: { 2: 100 } } And I also have another ByteString 'hotel' with this content: 1: 87354 2: { (...) a lot of content here } Now I need: 1. Put the 'hotel' ByteString under a "Hotels" tag with