MCPcopy Index your code
hub / github.com/Sable/axml / read

Method read

src/pxb/android/StringItems.java:30–64  ·  view source on GitHub ↗
(ByteBuffer in)

Source from the content-addressed store, hash-verified

28
29
30 public static String[] read(ByteBuffer in) throws IOException {
31 int trunkOffset = in.position() - 8;
32 int stringCount = in.getInt();
33 int styleOffsetCount = in.getInt();
34 int flags = in.getInt();
35 int stringDataOffset = in.getInt();
36 int stylesOffset = in.getInt();
37 int offsets[] = new int[stringCount];
38 String strings[] = new String[stringCount];
39 for (int i = 0; i < stringCount; i++) {
40 offsets[i] = in.getInt();
41 }
42
43 int base = trunkOffset + stringDataOffset;
44 for (int i = 0; i < offsets.length; i++) {
45 in.position(base + offsets[i]);
46 String s;
47
48 if (0 != (flags & UTF8_FLAG)) {
49 u8length(in); // ignored
50 int u8len = u8length(in);
51 int start = in.position();
52 int blength = u8len;
53 while (in.get(start + blength) != 0) {
54 blength++;
55 }
56 s = new String(in.array(), start, blength, "UTF-8");
57 } else {
58 int length = u16length(in);
59 s = new String(in.array(), in.position(), length * 2, "UTF-16LE");
60 }
61 strings[i] = s;
62 }
63 return strings;
64 }
65
66 static int u16length(ByteBuffer in) {
67 int length = in.getShort() & 0xFFFF;

Callers 5

parseMethod · 0.95
readPackageMethod · 0.95
nextMethod · 0.95
readFileMethod · 0.80
copyMethod · 0.80

Calls 2

u8lengthMethod · 0.95
u16lengthMethod · 0.95

Tested by

no test coverage detected