Created
June 5, 2017 07:28
-
-
Save dmi3coder/875c9617f4fc662f6dabb582080743e3 to your computer and use it in GitHub Desktop.
protobuf object to bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Note note = Note.newBuilder() | |
.setName("But list") | |
.setContent("Buy:\n" | |
+ "- Beer\n" | |
+ "- Beef\n" | |
+ "- Bacon\n" | |
+ "- Leg for C++ client part") | |
.setId(((long) (Math.random() * 900000000))) | |
.setType(NoteType.BASIC).build(); | |
Envelope requesetEnvelope = Envelope.newBuilder().addNote(note).setType(Type.SAVE_NOTE).build(); | |
byte[] bytesToSend = requesetEnvelope.toByteArray();//we're done here, send in any way you want. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment