Top Description Inners Fields Constructors Methods
com.ibm.icu.impl

public final Class ICUResourceBundleReader

extends Object
Class Inheritance
Imports
java.io.IOException, .InputStream, java.lang.ref.SoftReference, java.nio.ByteBuffer, .CharBuffer, .IntBuffer, java.nio.charset.StandardCharsets, java.util.Arrays, com.ibm.icu.util.ICUException, .ICUUncheckedIOException, .ULocale, .UResourceBundle, .UResourceTypeMismatchException, .VersionInfo

This class reads the *.res resource bundle format. For the file format documentation see ICU4C's source/common/uresdata.h file.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
private static class
private static class
pack-priv static class
private static class
private static class
private static class
pack-priv static class
private static class
ICUResourceBundleReader.ResourceCache

Cache of some of one resource bundle's resources.

pack-priv static class
private static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
private CharBuffer
private ByteBuffer
bytes

Buffer of all of the resource bundle bytes after the header.

private static ICUResourceBundleReader.ReaderCache
private static final int
DATA_FORMAT

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[]
pack-priv static final int
LARGE_SIZE

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[]
PUBLIC_TYPES

From C++ uresdata.c gPublicTypes[URES_LIMIT].

private ICUResourceBundleReader.ResourceCache
private int
private static final int
private static final int
private static final int
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)

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

private static final int
URES_INDEX_BUNDLE_TOP

[3] contains the top of the bundle, in case it were ever different from [2]

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

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

private static final int
private static final int
URES_INDEX_POOL_CHECKSUM

[7] checksum of the pool bundle (new in formatVersion 2.0, ICU 4.4)

private boolean

Constructor Summary

AccessConstructor and Description
private
private
ICUResourceBundleReader(ByteBuffer inBytes, String baseName, String localeID, ClassLoader loader)

Method Summary

Modifier and TypeMethod and Description
private int
compareKeys(CharSequence key, char keyOffset)

private int
compareKeys32(CharSequence key, int keyOffset)

pack-priv String
getAlias(int res)

pack-priv ICUResourceBundleReader.Array
getArray(int res)

pack-priv byte[]
getBinary(int res, byte[] ba)

pack-priv ByteBuffer
getBinary(int res)

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

public static String
getFullName(String baseName, String localeName)

Gets the full name of the resource with suffix.

private int
private int
getInt(int offset)

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

pack-priv int[]
getIntVector(int res)

private String
getKey16String(int keyOffset)

private String
getKey32String(int keyOffset)

pack-priv boolean
pack-priv static ICUResourceBundleReader
getReader(String baseName, String localeID, ClassLoader root)

private int
pack-priv int
pack-priv String
getString(int res)

pack-priv String

Returns:

a string from the local bundle's b16BitUnits at the local offset
getStringV2
(int res)

pack-priv ICUResourceBundleReader.Table
getTable(int res)

private char[]
private int[]
private char[]
getTableKeyOffsets(int offset)

pack-priv boolean
pack-priv VersionInfo
private void
init(ByteBuffer inBytes)

private boolean
isNoInheritanceMarker(int res)

CLDR string value "∅∅∅"=="∅∅∅" prevents fallback to the parent bundle.

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

private String
makeStringFromBytes(int offset, int length)

pack-priv static int
RES_GET_INT(int res)

private static int
RES_GET_OFFSET(int res)

pack-priv static int
RES_GET_TYPE(int res)

pack-priv static int
RES_GET_UINT(int res)

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

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

pack-priv static boolean
URES_IS_ARRAY(int type)

pack-priv static boolean
URES_IS_TABLE(int type)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait