MCPcopy Create free account
hub / github.com/L-JINBIN/ApkDataMultiplexing / trim

Method trim

src/bin/zip/ExtraDataRecord.java:71–82  ·  view source on GitHub ↗

去除无效数据

(byte[] extra)

Source from the content-addressed store, hash-verified

69 * 去除无效数据
70 */
71 public static byte[] trim(byte[] extra) throws IOException {
72 int offset = 0;
73 while (extra.length - offset >= 4) {
74 int header = ZipUtil.readUShort(extra, offset);
75 int size = ZipUtil.readUShort(extra, offset + 2);
76 if (!KNOWN_HEADER.contains(header) || offset + 4 + size > extra.length) {
77 break;
78 }
79 offset += 4 + size;
80 }
81 return Arrays.copyOf(extra, offset);
82 }
83
84 public static byte[] set(byte[] extra, int header, byte[] data) throws IOException {
85 extra = remove(extra, header);

Callers 1

alignMethod · 0.95

Calls 1

readUShortMethod · 0.95

Tested by

no test coverage detected