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

public final Class UPropertyAliases

extends Object
Class Inheritance
Imports
java.io.IOException, java.nio.ByteBuffer, java.util.MissingResourceException, com.ibm.icu.lang.UProperty, com.ibm.icu.util.BytesTrie

Wrapper for the pnames.icu binary data file. This data file is imported from icu4c. It contains property and property value aliases from the UCD files PropertyAliases.txt and PropertyValueAliases.txt. The file is built by the icu4c tool genpname. It must be an ASCII big-endian file to be usable in icu4j. This class performs two functions. (1) It can import the flat binary data into usable objects. (2) It provides an API to access the tree of objects. Needless to say, this class is tightly coupled to the binary format of icu4c's pnames.icu file. Each time a UPropertyAliases is constructed, the pnames.icu file is read, parsed, and data structures assembled. Clients should create one singleton instance and cache it.
Author
Alan Liu
Since
ICU 2.4

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private byte[]
private static final int
public static final UPropertyAliases
private static final UPropertyAliases.IsAcceptable
private static final int
private static final int
private static final int
private static final int
private String
private int[]

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static int
public static int
compare(String stra, String strb)

Compare two property names, returning <0, 0, or >0.

private boolean
private int
findProperty(int property)

private int
findPropertyValueNameGroup(int valueMapIndex, int value)

private String
getName(int nameGroupsIndex, int nameIndex)

public int
getPropertyEnum(CharSequence alias)

Returns a property enum given one of its property names.

public String
getPropertyName(int property, int nameChoice)

Returns a property name given a property enum.

private int
getPropertyOrValueEnum(int bytesTrieOffset, CharSequence alias)

public int
getPropertyValueEnum(int property, CharSequence alias)

Returns a value enum given a property enum and one of its value names.

public int

Returns:

value enum, or UProperty.UNDEFINED if not defined for that property
getPropertyValueEnumNoThrow
(int property, CharSequence alias)

Returns a value enum given a property enum and one of its value names.

public String
getPropertyValueName(int property, int value, int nameChoice)

Returns a value name given a property enum and a value enum.

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bytesTriesback to summary
private byte[] bytesTries
DATA_FORMATback to summary
private static final int DATA_FORMAT
INSTANCEback to summary
public static final UPropertyAliases INSTANCE
IS_ACCEPTABLEback to summary
private static final UPropertyAliases.IsAcceptable IS_ACCEPTABLE
IX_BYTE_TRIES_OFFSETback to summary
private static final int IX_BYTE_TRIES_OFFSET
IX_NAME_GROUPS_OFFSETback to summary
private static final int IX_NAME_GROUPS_OFFSET
IX_RESERVED3_OFFSETback to summary
private static final int IX_RESERVED3_OFFSET
IX_VALUE_MAPS_OFFSETback to summary
private static final int IX_VALUE_MAPS_OFFSET
nameGroupsback to summary
private String nameGroups
valueMapsback to summary
private int[] valueMaps

Constructor Detail

UPropertyAliasesback to summary
private UPropertyAliases() throws IOException

Method Detail

asciiToLowercaseback to summary
private static int asciiToLowercase(int c)
compareback to summary
public static int compare(String stra, String strb)

Compare two property names, returning <0, 0, or >0. The comparison is that described as "loose" matching in the Property*Aliases.txt files.

containsNameback to summary
private boolean containsName(BytesTrie trie, CharSequence name)
findPropertyback to summary
private int findProperty(int property)
findPropertyValueNameGroupback to summary
private int findPropertyValueNameGroup(int valueMapIndex, int value)
getNameback to summary
private String getName(int nameGroupsIndex, int nameIndex)
getPropertyEnumback to summary
public int getPropertyEnum(CharSequence alias)

Returns a property enum given one of its property names. If the property name is not known, this method returns UProperty.UNDEFINED.

getPropertyNameback to summary
public String getPropertyName(int property, int nameChoice)

Returns a property name given a property enum. Multiple names may be available for each property; the nameChoice selects among them.

getPropertyOrValueEnumback to summary
private int getPropertyOrValueEnum(int bytesTrieOffset, CharSequence alias)
getPropertyValueEnumback to summary
public int getPropertyValueEnum(int property, CharSequence alias)

Returns a value enum given a property enum and one of its value names.

getPropertyValueEnumNoThrowback to summary
public int getPropertyValueEnumNoThrow(int property, CharSequence alias)

Returns a value enum given a property enum and one of its value names. Does not throw.

Returns:int

value enum, or UProperty.UNDEFINED if not defined for that property

getPropertyValueNameback to summary
public String getPropertyValueName(int property, int value, int nameChoice)

Returns a value name given a property enum and a value enum. Multiple names may be available for each value; the nameChoice selects among them.

loadback to summary
private void load(ByteBuffer bytes) throws IOException
com.ibm.icu.impl back to summary

private final Class UPropertyAliases.IsAcceptable

extends Object
implements Authenticate
Class Inheritance
All Implemented Interfaces
com.ibm.icu.impl.ICUBinary.Authenticate

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
isDataVersionAcceptable(byte[]
version of the current data
version
)

Implements com.ibm.icu.impl.ICUBinary.Authenticate.isDataVersionAcceptable.

Method used in ICUBinary.readHeader() to provide data format authentication.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

IsAcceptableback to summary
private IsAcceptable()

Method Detail

isDataVersionAcceptableback to summary
public boolean isDataVersionAcceptable(byte[] version)

Implements com.ibm.icu.impl.ICUBinary.Authenticate.isDataVersionAcceptable.

Doc from com.ibm.icu.impl.ICUBinary.Authenticate.isDataVersionAcceptable.

Method used in ICUBinary.readHeader() to provide data format authentication.

Parameters
version:byte[]

version of the current data

Returns:boolean

true if dataformat is an acceptable version, false otherwise

Annotations
@Override