Class ICUResourceBundleReader

java.lang.Object
com.ibm.icu.impl.ICUResourceBundleReader

public final class ICUResourceBundleReader extends Object
This class reads the *.res resource bundle format. For the file format documentation see ICU4C's source/common/uresdata.h file.
  • Field Details

    • DATA_FORMAT

      private static final int DATA_FORMAT
      File format version that this class understands. "ResB"
      See Also:
    • IS_ACCEPTABLE

      private static final ICUResourceBundleReader.IsAcceptable IS_ACCEPTABLE
    • URES_INDEX_LENGTH

      private static final int URES_INDEX_LENGTH
      [0] contains the length of indexes[] which is at most URES_INDEX_TOP of the latest format version formatVersion==1: all bits contain the length of indexes[] but the length is much less than 0xff; formatVersion>1: only bits 7..0 contain the length of indexes[], bits 31..8 are reserved and set to 0 formatVersion>=3: bits 31..8 poolStringIndexLimit bits 23..0
      See Also:
    • URES_INDEX_KEYS_TOP

      private static final int URES_INDEX_KEYS_TOP
      [1] contains the top of the key strings, same as the bottom of resources or UTF-16 strings, rounded up
      See Also:
    • URES_INDEX_BUNDLE_TOP

      private static final int URES_INDEX_BUNDLE_TOP
      [3] contains the top of the bundle, in case it were ever different from [2]
      See Also:
    • URES_INDEX_MAX_TABLE_LENGTH

      private static final int URES_INDEX_MAX_TABLE_LENGTH
      [4] max. length of any table
      See Also:
    • URES_INDEX_ATTRIBUTES

      private static final int URES_INDEX_ATTRIBUTES
      [5] attributes bit set, see URES_ATT_* (new in formatVersion 1.2) formatVersion>=3: bits 31..16 poolStringIndex16Limit bits 15..12 poolStringIndexLimit bits 27..24
      See Also:
    • URES_INDEX_16BIT_TOP

      private static final int URES_INDEX_16BIT_TOP
      [6] top of the 16-bit units (UTF-16 string v2 UChars, URES_TABLE16, URES_ARRAY16), rounded up (new in formatVersion 2.0, ICU 4.4)
      See Also:
    • URES_INDEX_POOL_CHECKSUM

      private static final int URES_INDEX_POOL_CHECKSUM
      [7] checksum of the pool bundle (new in formatVersion 2.0, ICU 4.4)
      See Also:
    • URES_ATT_NO_FALLBACK

      private static final int URES_ATT_NO_FALLBACK
      See Also:
    • URES_ATT_IS_POOL_BUNDLE

      private static final int URES_ATT_IS_POOL_BUNDLE
      See Also:
    • URES_ATT_USES_POOL_BUNDLE

      private static final int URES_ATT_USES_POOL_BUNDLE
      See Also:
    • EMPTY_16_BIT_UNITS

      private static final CharBuffer EMPTY_16_BIT_UNITS
    • LARGE_SIZE

      static final int LARGE_SIZE
      Objects with more value bytes are stored in SoftReferences. Smaller objects (which are not much larger than a SoftReference) are stored directly, avoiding the overhead of the reference.
      See Also:
    • DEBUG

      private static final boolean DEBUG
      See Also:
    • dataVersion

      private int dataVersion
    • bytes

      private ByteBuffer bytes
      Buffer of all of the resource bundle bytes after the header. (equivalent of C++ pRoot)
    • keyBytes

      private byte[] keyBytes
    • b16BitUnits

      private CharBuffer b16BitUnits
    • poolBundleReader

      private ICUResourceBundleReader poolBundleReader
    • rootRes

      private int rootRes
    • localKeyLimit

      private int localKeyLimit
    • poolStringIndexLimit

      private int poolStringIndexLimit
    • poolStringIndex16Limit

      private int poolStringIndex16Limit
    • noFallback

      private boolean noFallback
    • isPoolBundle

      private boolean isPoolBundle
    • usesPoolBundle

      private boolean usesPoolBundle
    • poolCheckSum

      private int poolCheckSum
    • resourceCache

    • CACHE

    • NULL_READER

      private static final ICUResourceBundleReader NULL_READER
    • emptyBytes

      private static final byte[] emptyBytes
    • emptyByteBuffer

      private static final ByteBuffer emptyByteBuffer
    • emptyChars

      private static final char[] emptyChars
    • emptyInts

      private static final int[] emptyInts
    • emptyString

      private static final String emptyString
      See Also:
    • EMPTY_ARRAY

      private static final ICUResourceBundleReader.Array EMPTY_ARRAY
    • EMPTY_TABLE

      private static final ICUResourceBundleReader.Table EMPTY_TABLE
    • PUBLIC_TYPES

      private static int[] PUBLIC_TYPES
      From C++ uresdata.c gPublicTypes[URES_LIMIT].
    • ICU_RESOURCE_SUFFIX

      private static final String ICU_RESOURCE_SUFFIX
      See Also:
  • Constructor Details

  • Method Details

    • getReader

      static ICUResourceBundleReader getReader(String baseName, String localeID, ClassLoader root)
    • init

      private void init(ByteBuffer inBytes) throws IOException
      Throws:
      IOException
    • getIndexesInt

      private int getIndexesInt(int i)
    • getVersion

      VersionInfo getVersion()
    • getRootResource

      int getRootResource()
    • getNoFallback

      boolean getNoFallback()
    • getUsesPoolBundle

      boolean getUsesPoolBundle()
    • RES_GET_TYPE

      static int RES_GET_TYPE(int res)
    • RES_GET_OFFSET

      private static int RES_GET_OFFSET(int res)
    • getResourceByteOffset

      private int getResourceByteOffset(int offset)
    • RES_GET_INT

      static int RES_GET_INT(int res)
    • RES_GET_UINT

      static int RES_GET_UINT(int res)
    • URES_IS_ARRAY

      static boolean URES_IS_ARRAY(int type)
    • URES_IS_TABLE

      static boolean URES_IS_TABLE(int type)
    • getChars

      private char[] getChars(int offset, int count)
    • getInt

      private int getInt(int offset)
    • getInts

      private int[] getInts(int offset, int count)
    • getTable16KeyOffsets

      private char[] getTable16KeyOffsets(int offset)
    • getTableKeyOffsets

      private char[] getTableKeyOffsets(int offset)
    • getTable32KeyOffsets

      private int[] getTable32KeyOffsets(int offset)
    • makeKeyStringFromBytes

      private static String makeKeyStringFromBytes(byte[] keyBytes, int keyOffset)
    • getKey16String

      private String getKey16String(int keyOffset)
    • getKey32String

      private String getKey32String(int keyOffset)
    • setKeyFromKey16

      private void setKeyFromKey16(int keyOffset, UResource.Key key)
    • setKeyFromKey32

      private void setKeyFromKey32(int keyOffset, UResource.Key key)
    • compareKeys

      private int compareKeys(CharSequence key, char keyOffset)
    • compareKeys32

      private int compareKeys32(CharSequence key, int keyOffset)
    • getStringV2

      String getStringV2(int res)
      Returns:
      a string from the local bundle's b16BitUnits at the local offset
    • makeStringFromBytes

      private String makeStringFromBytes(int offset, int length)
    • getString

      String getString(int res)
    • isNoInheritanceMarker

      private boolean isNoInheritanceMarker(int res)
      CLDR string value "∅∅∅"=="∅∅∅" prevents fallback to the parent bundle.
    • isStringV2NoInheritanceMarker

      private boolean isStringV2NoInheritanceMarker(int offset)
    • getAlias

      String getAlias(int res)
    • getBinary

      byte[] getBinary(int res, byte[] ba)
    • getBinary

      ByteBuffer getBinary(int res)
    • getIntVector

      int[] getIntVector(int res)
    • getArray

      ICUResourceBundleReader.Array getArray(int res)
    • getTable

      ICUResourceBundleReader.Table getTable(int res)
    • getFullName

      public static String getFullName(String baseName, String localeName)
      Gets the full name of the resource with suffix.