Package com.ibm.icu.impl
Class ICUResourceBundleReader
java.lang.Object
com.ibm.icu.impl.ICUResourceBundleReader
This class reads the *.res resource bundle format.
For the file format documentation see ICU4C's source/common/uresdata.h file.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classprivate static final classprivate static final class(package private) static classprivate static final classprivate static classprivate static class(package private) static classprivate static final classCache of some of one resource bundle's resources.(package private) static classprivate static final classprivate static final classprivate static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate CharBufferprivate ByteBufferBuffer of all of the resource bundle bytes after the header.private static ICUResourceBundleReader.ReaderCacheprivate static final intFile format version that this class understands.private intprivate static final booleanprivate static final CharBufferprivate static final ICUResourceBundleReader.Arrayprivate static final ICUResourceBundleReader.Tableprivate static final ByteBufferprivate static final byte[]private static final char[]private static final int[]private static final Stringprivate static final Stringprivate static final ICUResourceBundleReader.IsAcceptableprivate booleanprivate byte[](package private) static final intObjects with more value bytes are stored in SoftReferences.private intprivate booleanprivate static final ICUResourceBundleReaderprivate ICUResourceBundleReaderprivate intprivate intprivate intprivate static int[]From C++ uresdata.c gPublicTypes[URES_LIMIT].private intprivate static final intprivate static final intprivate static final intprivate static final int[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)private static final int[5] attributes bit set, see URES_ATT_* (new in formatVersion 1.2) formatVersion>=3: bits 31..16 poolStringIndex16Limit bits 15..12 poolStringIndexLimit bits 27..24private static final int[3] contains the top of the bundle, in case it were ever different from [2]private static final int[1] contains the top of the key strings, same as the bottom of resources or UTF-16 strings, rounded upprivate static final int[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..0private static final int[4] max.private static final int[7] checksum of the pool bundle (new in formatVersion 2.0, ICU 4.4)private boolean -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateprivateICUResourceBundleReader(ByteBuffer inBytes, String baseName, String localeID, ClassLoader loader) -
Method Summary
Modifier and TypeMethodDescriptionprivate intcompareKeys(CharSequence key, char keyOffset) private intcompareKeys32(CharSequence key, int keyOffset) (package private) StringgetAlias(int res) (package private) ICUResourceBundleReader.ArraygetArray(int res) (package private) ByteBuffergetBinary(int res) (package private) byte[]getBinary(int res, byte[] ba) private char[]getChars(int offset, int count) static StringgetFullName(String baseName, String localeName) Gets the full name of the resource with suffix.private intgetIndexesInt(int i) private intgetInt(int offset) private int[]getInts(int offset, int count) (package private) int[]getIntVector(int res) private StringgetKey16String(int keyOffset) private StringgetKey32String(int keyOffset) (package private) boolean(package private) static ICUResourceBundleReadergetReader(String baseName, String localeID, ClassLoader root) private intgetResourceByteOffset(int offset) (package private) int(package private) StringgetString(int res) (package private) StringgetStringV2(int res) (package private) ICUResourceBundleReader.TablegetTable(int res) private char[]getTable16KeyOffsets(int offset) private int[]getTable32KeyOffsets(int offset) private char[]getTableKeyOffsets(int offset) (package private) boolean(package private) VersionInfoprivate voidinit(ByteBuffer inBytes) private booleanisNoInheritanceMarker(int res) CLDR string value "∅∅∅"=="∅∅∅" prevents fallback to the parent bundle.private booleanisStringV2NoInheritanceMarker(int offset) private static StringmakeKeyStringFromBytes(byte[] keyBytes, int keyOffset) private StringmakeStringFromBytes(int offset, int length) (package private) static intRES_GET_INT(int res) private static intRES_GET_OFFSET(int res) (package private) static intRES_GET_TYPE(int res) (package private) static intRES_GET_UINT(int res) private voidsetKeyFromKey16(int keyOffset, UResource.Key key) private voidsetKeyFromKey32(int keyOffset, UResource.Key key) (package private) static booleanURES_IS_ARRAY(int type) (package private) static booleanURES_IS_TABLE(int type)
-
Field Details
-
DATA_FORMAT
private static final int DATA_FORMATFile format version that this class understands. "ResB"- See Also:
-
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
-
LARGE_SIZE
static final int LARGE_SIZEObjects 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
Buffer of all of the resource bundle bytes after the header. (equivalent of C++ pRoot) -
keyBytes
private byte[] keyBytes -
b16BitUnits
-
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
-
emptyBytes
private static final byte[] emptyBytes -
emptyByteBuffer
-
emptyChars
private static final char[] emptyChars -
emptyInts
private static final int[] emptyInts -
emptyString
- See Also:
-
EMPTY_ARRAY
-
EMPTY_TABLE
-
PUBLIC_TYPES
private static int[] PUBLIC_TYPESFrom C++ uresdata.c gPublicTypes[URES_LIMIT]. -
ICU_RESOURCE_SUFFIX
- See Also:
-
-
Constructor Details
-
ICUResourceBundleReader
private ICUResourceBundleReader() -
ICUResourceBundleReader
private ICUResourceBundleReader(ByteBuffer inBytes, String baseName, String localeID, ClassLoader loader) throws IOException - Throws:
IOException
-
-
Method Details
-
getReader
-
init
- 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
-
getKey16String
-
getKey32String
-
setKeyFromKey16
-
setKeyFromKey32
-
compareKeys
-
compareKeys32
-
getStringV2
- Returns:
- a string from the local bundle's b16BitUnits at the local offset
-
makeStringFromBytes
-
getString
-
isNoInheritanceMarker
private boolean isNoInheritanceMarker(int res) CLDR string value "∅∅∅"=="∅∅∅" prevents fallback to the parent bundle. -
isStringV2NoInheritanceMarker
private boolean isStringV2NoInheritanceMarker(int offset) -
getAlias
-
getBinary
byte[] getBinary(int res, byte[] ba) -
getBinary
-
getIntVector
int[] getIntVector(int res) -
getArray
-
getTable
-
getFullName
Gets the full name of the resource with suffix.
-