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 class
private static final class
private static final class
(package private) static class
private static final class
private static class
private static class
(package private) static class
private static final class
Cache of some of one resource bundle's resources.(package private) static class
private static final class
private static final class
private static final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate CharBuffer
private ByteBuffer
Buffer of all of the resource bundle bytes after the header.private static ICUResourceBundleReader.ReaderCache
private static final int
File format version that this class understands.private int
private static final boolean
private static final CharBuffer
private static final ICUResourceBundleReader.Array
private static final ICUResourceBundleReader.Table
private static final ByteBuffer
private static final byte[]
private static final char[]
private static final int[]
private static final String
private static final String
private static final ICUResourceBundleReader.IsAcceptable
private boolean
private byte[]
(package private) static final int
Objects with more value bytes are stored in SoftReferences.private int
private boolean
private static final ICUResourceBundleReader
private ICUResourceBundleReader
private int
private int
private int
private static int[]
From C++ uresdata.c gPublicTypes[URES_LIMIT].private int
private static final int
private static final int
private static final int
private 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
ConstructorsModifierConstructorDescriptionprivate
private
ICUResourceBundleReader
(ByteBuffer inBytes, String baseName, String localeID, ClassLoader loader) -
Method Summary
Modifier and TypeMethodDescriptionprivate int
compareKeys
(CharSequence key, char keyOffset) private int
compareKeys32
(CharSequence key, int keyOffset) (package private) String
getAlias
(int res) (package private) ICUResourceBundleReader.Array
getArray
(int res) (package private) ByteBuffer
getBinary
(int res) (package private) byte[]
getBinary
(int res, byte[] ba) private char[]
getChars
(int offset, int count) static String
getFullName
(String baseName, String localeName) Gets the full name of the resource with suffix.private int
getIndexesInt
(int i) private int
getInt
(int offset) private int[]
getInts
(int offset, int count) (package private) int[]
getIntVector
(int res) private String
getKey16String
(int keyOffset) private String
getKey32String
(int keyOffset) (package private) boolean
(package private) static ICUResourceBundleReader
getReader
(String baseName, String localeID, ClassLoader root) private int
getResourceByteOffset
(int offset) (package private) int
(package private) String
getString
(int res) (package private) String
getStringV2
(int res) (package private) ICUResourceBundleReader.Table
getTable
(int res) private char[]
getTable16KeyOffsets
(int offset) private int[]
getTable32KeyOffsets
(int offset) private char[]
getTableKeyOffsets
(int offset) (package private) boolean
(package private) VersionInfo
private void
init
(ByteBuffer inBytes) private boolean
isNoInheritanceMarker
(int res) CLDR string value "∅∅∅"=="∅∅∅" prevents fallback to the parent bundle.private boolean
isStringV2NoInheritanceMarker
(int offset) private static String
makeKeyStringFromBytes
(byte[] keyBytes, int keyOffset) private String
makeStringFromBytes
(int offset, int length) (package private) static int
RES_GET_INT
(int res) private static int
RES_GET_OFFSET
(int res) (package private) static int
RES_GET_TYPE
(int res) (package private) static int
RES_GET_UINT
(int res) private void
setKeyFromKey16
(int keyOffset, UResource.Key key) private void
setKeyFromKey32
(int keyOffset, UResource.Key key) (package private) static boolean
URES_IS_ARRAY
(int type) (package private) static boolean
URES_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.
-