Advertisement
hnOsmium0001

Untitled

Aug 23rd, 2020
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. public interface DataFormat {
  2. Data parse(byte[] data);
  3. }
  4.  
  5. Map<int, DataFormat> id2format;
  6.  
  7. // 初始化:
  8. id2format.put(0, new DataFormatV0());
  9. id2format.put(1, new DataFormatV1());
  10.  
  11. // 解析数据:
  12. Data data = id2format.get(blob.versionId).parse(blob.data);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement