Skip to content

Deserialize protobuf message without Protobuf Java Class。combine the schema of protobuf and the flexible of json .

Notifications You must be signed in to change notification settings

lyl625760/dynamic-protobuf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

dynamic-protobuf

Combine the schema of google protocol buffer and the flexible of json format. It helps you parse any message which is serialized by Google protobuf without compiled protobuf java class

Features :

  1. Deserialize protobuf message without Protobuf Java Class。
  2. All its need is .desc file,which is generated by .proto file .
  3. Campatibale with Google protobuf 2.0 & 3.0 format.

Example :

// Step 1: init ProtobufUtil

        
        ProtobufUtil util = new ProtobufUtil();
        try(InputStream inputStream = Test.class.getResourceAsStream("/message.desc"))
        {
            util.init(inputStream);
        }

Notice :

// You can generate proto desc file from proto file like this:
protoc --proto_path=./  --java_out=./ a.proto --descriptor_set_out=message.desc

// Step2 : deserialize protobuf message without Protobuf Java Class

        util.parseMessage(bytes,messageName,fieldName)

you can refer to the examples in src/main/test/Test

<dependency>
  <groupId>io.github.lyl625760</groupId>
  <artifactId>dynamic-protobuf</artifactId>
  <version>1.1-SNAPSHOT</version>
</dependency>

About

Deserialize protobuf message without Protobuf Java Class。combine the schema of protobuf and the flexible of json .

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages