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;








2















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;










share|improve this question


























  • 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

















2















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;










share|improve this question


























  • 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













2












2








2








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;










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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

















  • 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












1 Answer
1






active

oldest

votes


















0















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.






share|improve this answer



























  • 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, the int* types (except for fixedint) are variable length encoded so that is probably your best bet.

    – Nick Chapman
    Mar 28 at 15:56










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
);



);













draft saved

draft discarded


















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









0















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.






share|improve this answer



























  • 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, the int* types (except for fixedint) are variable length encoded so that is probably your best bet.

    – Nick Chapman
    Mar 28 at 15:56















0















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.






share|improve this answer



























  • 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, the int* types (except for fixedint) are variable length encoded so that is probably your best bet.

    – Nick Chapman
    Mar 28 at 15:56













0














0










0









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.






share|improve this answer















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.







share|improve this answer














share|improve this answer



share|improve this answer








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, the int* 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











  • @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
















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








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.



















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현