How to store a single byte in a protocol buffer?Biggest differences of Thrift vs Protocol Buffers?Google Protocol Buffers - Fixed size buffer?what's the right way to do polymorphism with protocol buffers?How to get the byte[] from a protocol buffer serialized data for writing to database?Storing unspecified Protocol Buffer messages in another PB message?google protocol buffers vs json vs XMLStore a single byte in a protobuf messageBest practice for determining the type of a protocol buffers messageGoogle Protocol Buffers: find out what message is encoded in byte[]java.lang.IndexOutOfBoundsException - when building Java Object using Protocol buffer
Count the number of triangles
Scaling arrows.meta with tranform shape
What is the following VRP?
How to differentiate between two people with the same name in a story?
How can I observe Sgr A* with itelescope.net
Why does Sauron not permit his followers to use his name?
What's the difference between a variable and a memory location?
Do universities maintain secret textbooks?
Why are JWST optics not enclosed like HST?
Why doesn't Starship have four landing legs?
Did the Apollo Guidance Computer really use 60% of the world's ICs in 1963?
Moscow SVO airport, how to avoid scam taxis without pre-booking?
How do you say "half the time …, the other half …" in German?
Is this homebrew "Faerie Fire Grenade" unbalanced?
Where should I draw the line on follow up questions from previous employer
Printing a list as "a, b, c." using Python
Create a list of snaking numbers under 50,000
Answer with an image of my favorite musician
What is the purpose of Strength, Intelligence and Dexterity in Path of Exile?
Coupling two 15 Amp circuit breaker for 20 Amp
Wrong Stamping of UK Visa
What are ways to record who took the pictures if a camera is used by multiple people
Can I lend a small amount of my own money to a bank at the federal funds rate?
Did ancient peoples ever hide their treasure behind puzzles?
How to store a single byte in a protocol buffer?
Biggest differences of Thrift vs Protocol Buffers?Google Protocol Buffers - Fixed size buffer?what's the right way to do polymorphism with protocol buffers?How to get the byte[] from a protocol buffer serialized data for writing to database?Storing unspecified Protocol Buffer messages in another PB message?google protocol buffers vs json vs XMLStore a single byte in a protobuf messageBest practice for determining the type of a protocol buffers messageGoogle Protocol Buffers: find out what message is encoded in byte[]java.lang.IndexOutOfBoundsException - when building Java Object using Protocol buffer
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
my java class is below,
public final class TraceOptions {
private final byte options;
private TraceOptions(byte options)
this.options = options;
What type in protobuffer 3 should I put here?
message TraceOptions
? traceOptions = 1;
protocol-buffers google-protocol-buffer
add a comment |
my java class is below,
public final class TraceOptions {
private final byte options;
private TraceOptions(byte options)
this.options = options;
What type in protobuffer 3 should I put here?
message TraceOptions
? traceOptions = 1;
protocol-buffers google-protocol-buffer
There is no type for byte in protobuff 2 and 3.
– Prasath
Mar 28 at 12:51
you will have to use int32, there is no "byte".
– Dylan
Mar 28 at 14:59
add a comment |
my java class is below,
public final class TraceOptions {
private final byte options;
private TraceOptions(byte options)
this.options = options;
What type in protobuffer 3 should I put here?
message TraceOptions
? traceOptions = 1;
protocol-buffers google-protocol-buffer
my java class is below,
public final class TraceOptions {
private final byte options;
private TraceOptions(byte options)
this.options = options;
What type in protobuffer 3 should I put here?
message TraceOptions
? traceOptions = 1;
protocol-buffers google-protocol-buffer
protocol-buffers google-protocol-buffer
edited Mar 28 at 17:12
Nick Chapman
2,71016 silver badges28 bronze badges
2,71016 silver badges28 bronze badges
asked Mar 27 at 22:11
zheyi yizheyi yi
367 bronze badges
367 bronze badges
There is no type for byte in protobuff 2 and 3.
– Prasath
Mar 28 at 12:51
you will have to use int32, there is no "byte".
– Dylan
Mar 28 at 14:59
add a comment |
There is no type for byte in protobuff 2 and 3.
– Prasath
Mar 28 at 12:51
you will have to use int32, there is no "byte".
– Dylan
Mar 28 at 14:59
There is no type for byte in protobuff 2 and 3.
– Prasath
Mar 28 at 12:51
There is no type for byte in protobuff 2 and 3.
– Prasath
Mar 28 at 12:51
you will have to use int32, there is no "byte".
– Dylan
Mar 28 at 14:59
you will have to use int32, there is no "byte".
– Dylan
Mar 28 at 14:59
add a comment |
1 Answer
1
active
oldest
votes
Are you just looking for bytes
? It's listed under the Scalar Value Types
in the docs. It's typically used to store a variable length number of bytes, so not sure on the efficiency of using it to store a single byte.
The type uint32
uses a variable length encoding, so that's probably the most efficient thing you can do.
If you look at how integers are encoded in the docs here you'll see that using an int32 is likely your best bet.
I am looking for byte, not for bytes
– zheyi yi
Mar 28 at 15:41
@zheyiyi then as noted by Prasath and Dylan you will need to use something else, there is no single byte option.
– Nick Chapman
Mar 28 at 15:54
@zheyiyi updated answer, theint*
types (except for fixedint) are variable length encoded so that is probably your best bet.
– Nick Chapman
Mar 28 at 15:56
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55387245%2fhow-to-store-a-single-byte-in-a-protocol-buffer%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Are you just looking for bytes
? It's listed under the Scalar Value Types
in the docs. It's typically used to store a variable length number of bytes, so not sure on the efficiency of using it to store a single byte.
The type uint32
uses a variable length encoding, so that's probably the most efficient thing you can do.
If you look at how integers are encoded in the docs here you'll see that using an int32 is likely your best bet.
I am looking for byte, not for bytes
– zheyi yi
Mar 28 at 15:41
@zheyiyi then as noted by Prasath and Dylan you will need to use something else, there is no single byte option.
– Nick Chapman
Mar 28 at 15:54
@zheyiyi updated answer, theint*
types (except for fixedint) are variable length encoded so that is probably your best bet.
– Nick Chapman
Mar 28 at 15:56
add a comment |
Are you just looking for bytes
? It's listed under the Scalar Value Types
in the docs. It's typically used to store a variable length number of bytes, so not sure on the efficiency of using it to store a single byte.
The type uint32
uses a variable length encoding, so that's probably the most efficient thing you can do.
If you look at how integers are encoded in the docs here you'll see that using an int32 is likely your best bet.
I am looking for byte, not for bytes
– zheyi yi
Mar 28 at 15:41
@zheyiyi then as noted by Prasath and Dylan you will need to use something else, there is no single byte option.
– Nick Chapman
Mar 28 at 15:54
@zheyiyi updated answer, theint*
types (except for fixedint) are variable length encoded so that is probably your best bet.
– Nick Chapman
Mar 28 at 15:56
add a comment |
Are you just looking for bytes
? It's listed under the Scalar Value Types
in the docs. It's typically used to store a variable length number of bytes, so not sure on the efficiency of using it to store a single byte.
The type uint32
uses a variable length encoding, so that's probably the most efficient thing you can do.
If you look at how integers are encoded in the docs here you'll see that using an int32 is likely your best bet.
Are you just looking for bytes
? It's listed under the Scalar Value Types
in the docs. It's typically used to store a variable length number of bytes, so not sure on the efficiency of using it to store a single byte.
The type uint32
uses a variable length encoding, so that's probably the most efficient thing you can do.
If you look at how integers are encoded in the docs here you'll see that using an int32 is likely your best bet.
edited Mar 28 at 18:38
answered Mar 28 at 14:55
Nick ChapmanNick Chapman
2,71016 silver badges28 bronze badges
2,71016 silver badges28 bronze badges
I am looking for byte, not for bytes
– zheyi yi
Mar 28 at 15:41
@zheyiyi then as noted by Prasath and Dylan you will need to use something else, there is no single byte option.
– Nick Chapman
Mar 28 at 15:54
@zheyiyi updated answer, theint*
types (except for fixedint) are variable length encoded so that is probably your best bet.
– Nick Chapman
Mar 28 at 15:56
add a comment |
I am looking for byte, not for bytes
– zheyi yi
Mar 28 at 15:41
@zheyiyi then as noted by Prasath and Dylan you will need to use something else, there is no single byte option.
– Nick Chapman
Mar 28 at 15:54
@zheyiyi updated answer, theint*
types (except for fixedint) are variable length encoded so that is probably your best bet.
– Nick Chapman
Mar 28 at 15:56
I am looking for byte, not for bytes
– zheyi yi
Mar 28 at 15:41
I am looking for byte, not for bytes
– zheyi yi
Mar 28 at 15:41
@zheyiyi then as noted by Prasath and Dylan you will need to use something else, there is no single byte option.
– Nick Chapman
Mar 28 at 15:54
@zheyiyi then as noted by Prasath and Dylan you will need to use something else, there is no single byte option.
– Nick Chapman
Mar 28 at 15:54
@zheyiyi updated answer, the
int*
types (except for fixedint) are variable length encoded so that is probably your best bet.– Nick Chapman
Mar 28 at 15:56
@zheyiyi updated answer, the
int*
types (except for fixedint) are variable length encoded so that is probably your best bet.– Nick Chapman
Mar 28 at 15:56
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55387245%2fhow-to-store-a-single-byte-in-a-protocol-buffer%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
There is no type for byte in protobuff 2 and 3.
– Prasath
Mar 28 at 12:51
you will have to use int32, there is no "byte".
– Dylan
Mar 28 at 14:59