Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public interface DataFormat {
- Data parse(byte[] data);
- }
- Map<int, DataFormat> id2format;
- // 初始化:
- id2format.put(0, new DataFormatV0());
- id2format.put(1, new DataFormatV1());
- // 解析数据:
- Data data = id2format.get(blob.versionId).parse(blob.data);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement