Thursday, January 16, 2014

Read text format protobuf from file in Java


    java.io.InputStream inputStream = [open file and get input stream]

    java.io.InputStreamReader reader = new java.io.InputStreamReader(inputStream);

    MyProto.Builder myProtoBuilder = myProto.newBuilder();
    TextFormat.merge(reader, myProtoBuilder);

1 comment:

Anonymous said...

Thanks!!!