2015-09-01 68 views
-2

我搜索了四周的名稱來調用這個,但我找不到任何.... 它在.java文件中發送給我的朋友(他以爲我會直接解碼它),不知道我也是這個的noobi ... 這是我想要解碼的字符串數據而無需編譯Java文件。如何解碼.Java文件中的協議緩衝區字符串

String[] descriptorData = { 
    "\n0com/google/javascript/jscomp/function_" + 
    "info.proto\022\006jscomp\"\277\002\n\026FunctionInformati" + 
    "onMap\0223\n\005entry\030\001 \003(\n2$.jscomp.FunctionIn" + 
    "formationMap.Entry\0225\n\006module\030e \003(\n2%.jsc" + 
    "omp.FunctionInformationMap.Module\032\207\001\n\005En" + 
    "try\022\n\n\002id\030\002 \002(\005\022\023\n\013source_name\030\003 \002(\t\022\023\n\013" + 
    "line_number\030\004 \002(\005\022\023\n\013module_name\030\005 \002(\t\022\014" + 
    "\n\004size\030\006 \002(\005\022\014\n\004name\030\007 \002(\t\022\027\n\017compiled_s" + 
    "ource\030\010 \002(\t\032/\n\006Module\022\014\n\004name\030f \002(\t\022\027\n\017c" + 
    "ompiled_source\030g \002(\tB \n\034com.google.javas","cript.jscompP\001" 

回答

0

你看到的有,如果我沒有記錯的一塊自動生成描述

message FunctionInformationMap { 
    repeated group Entry = 1 { 
    required int32 id = 2; 
    required string source_name = 3; 
    required int32 line_number = 4; 
    required string module_name = 5; 
    required int32 size = 6; 
    required string name = 7; 
    required string compiled_source = 8; 
    } 
} 

它在這裏 https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/function_info.proto

,並在這裏生成的代碼可以被發現的代碼示例這裏

https://code.google.com/p/closure-compiler/source/browse/gen/com/google/javascript/jscomp/FunctionInfo.java?name=v20140407

Ps:我只是搜索了「com/google/javascript/jscomp/function_info.proto」,但實際上你可以逆轉這個過程。例如這裏提示https://www.sysdream.com/reverse-engineering-protobuf-apps

+0

你怎麼解碼它成爲這個純文本? – Noobshow

0

我只需使用System.Out.PrintIn打印出字符串數據到一個txt文件解決了這個...

就是這樣.. 謝謝...