1 package org.robolectric.res.android; 2 3 import org.robolectric.res.android.ResourceTypes.ResChunk_header; 4 5 /** 6 * Definition for a pool of strings. The data of this chunk is an 7 * array of uint32_t providing indices into the pool, relative to 8 * stringsStart. At stringsStart are all of the UTF-16 strings 9 * concatenated together; each starts with a uint16_t of the string's 10 * length and each ends with a 0x0000 terminator. If a string is > 11 * 32767 characters, the high bit of the length is set meaning to take 12 * those 15 bits as a high word and it will be followed by another 13 * uint16_t containing the low word. 14 * 15 * If styleCount is not zero, then immediately following the array of 16 * uint32_t indices into the string table is another array of indices 17 * into a style table starting at stylesStart. Each entry in the 18 * style table is an array of ResStringPool_span structures. 19 */ 20 // transliterated from https://android.googlesource.com/platform/frameworks/base/+/android-9.0.0_r12/include/androidfw/ResourceTypes.h#434 21 public class ResStringPoolHeader { 22 public static final int SIZEOF = ResChunk_header.SIZEOF + 20; 23 24 ResChunk_header header; 25 // Number of strings in this pool (number of uint32_t indices that follow 26 // in the data). 27 int stringCount; 28 // Number of style span arrays in the pool (number of uint32_t indices 29 // follow the string indices). 30 int styleCount; 31 32 // Flags. 33 34 // If set, the string index is sorted by the string values (based 35 // on strcmp16()). 36 public static final int SORTED_FLAG = 1<<0; 37 // String pool is encoded in UTF-8 38 public static final int UTF8_FLAG = 1<<8; 39 int flags; 40 41 // Index from header of the string data. 42 int stringsStart; 43 // Index from header of the style data. 44 int stylesStart; 45 } 46