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

public final Class RBBIDataWrapper

extends Object
Class Inheritance
Imports
java.io.DataOutputStream, .IOException, java.nio.ByteBuffer, java.nio.charset.StandardCharsets, java.util.Arrays, com.ibm.icu.impl.ICUBinary.Authenticate, com.ibm.icu.text.RuleBasedBreakIterator, com.ibm.icu.util.CodePointTrie

Internal class used for Rule Based Break Iterators.

This class provides access to the compiled break rule data, as it is stored in a .brk file. Refer to the file common/rbbidata.h from ICU4C for further details.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
public static class
public static class
RBBIDataWrapper.RBBIStateTable

A RBBI State Transition table, the form of the data used at run time in Java.

Field Summary

Modifier and TypeField and Description
public static final int
ACCEPTING

offset to the "accepting" field in a state table row.

public static final int
ACCEPTING_UNCONDITIONAL

value constant for the ACCEPTING field of a state table row.

public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public RBBIDataWrapper.RBBIStateTable
public RBBIDataWrapper.RBBIDataHeader
public static final int
public RBBIDataWrapper.RBBIStateTable
public String
public int[]
public CodePointTrie
private static final RBBIDataWrapper.IsAcceptable
public static final int
LOOKAHEAD

offset to the "lookahead" field in a state table row.

public static final int
NEXTSTATES

offset to the start of the next states array in a state table row.

public static final int
public static final int
public static final int
public static final int
TAGSIDX

offset to the "tagIndex" field in a state table row.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public static String
charToString(char n, int width)

public void
dump(PrintStream out)

Debug function to display the break iterator data.

private void
private void
dumpRow(PrintStream out, RBBIDataWrapper.RBBIStateTable table, char state)

Dump (for debug) a single row of an RBBI state table

private void
dumpTable(PrintStream out, RBBIDataWrapper.RBBIStateTable table)

Dump a state table.

public static boolean
equals(RBBIDataWrapper.RBBIStateTable left, RBBIDataWrapper.RBBIStateTable right)

Equals helper for state tables, including null handling.

public static RBBIDataWrapper
get(ByteBuffer bytes)

Get an RBBIDataWrapper from an InputStream onto a pre-compiled set of RBBI rules.

public int
getRowIndex(int state)

RBBI State Table Indexing Function.

public static String
intToHexString(int n, int width)

Fixed width int-to-string conversion.

public static String
intToString(int n, int width)

Fixed width int-to-string conversion.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ACCEPTINGback to summary
public static final int ACCEPTING

offset to the "accepting" field in a state table row.

ACCEPTING_UNCONDITIONALback to summary
public static final int ACCEPTING_UNCONDITIONAL

value constant for the ACCEPTING field of a state table row.

DATA_FORMATback to summary
public static final int DATA_FORMAT
DH_CATCOUNTback to summary
public static final int DH_CATCOUNT
DH_FORMATVERSIONback to summary
public static final int DH_FORMATVERSION
DH_FTABLEback to summary
public static final int DH_FTABLE
DH_FTABLELENback to summary
public static final int DH_FTABLELEN
DH_LENGTHback to summary
public static final int DH_LENGTH
DH_MAGICback to summary
public static final int DH_MAGIC
DH_RTABLEback to summary
public static final int DH_RTABLE
DH_RTABLELENback to summary
public static final int DH_RTABLELEN
DH_RULESOURCEback to summary
public static final int DH_RULESOURCE
DH_RULESOURCELENback to summary
public static final int DH_RULESOURCELEN
DH_SIZEback to summary
public static final int DH_SIZE
DH_STATUSTABLEback to summary
public static final int DH_STATUSTABLE
DH_STATUSTABLELENback to summary
public static final int DH_STATUSTABLELEN
DH_TRIEback to summary
public static final int DH_TRIE
DH_TRIELENback to summary
public static final int DH_TRIELEN
fFTableback to summary
public RBBIDataWrapper.RBBIStateTable fFTable
fHeaderback to summary
public RBBIDataWrapper.RBBIDataHeader fHeader
FORMAT_VERSIONback to summary
public static final int FORMAT_VERSION
fRTableback to summary
public RBBIDataWrapper.RBBIStateTable fRTable
fRuleSourceback to summary
public String fRuleSource
fStatusTableback to summary
public int[] fStatusTable
fTrieback to summary
public CodePointTrie fTrie
IS_ACCEPTABLEback to summary
private static final RBBIDataWrapper.IsAcceptable IS_ACCEPTABLE
LOOKAHEADback to summary
public static final int LOOKAHEAD

offset to the "lookahead" field in a state table row.

NEXTSTATESback to summary
public static final int NEXTSTATES

offset to the start of the next states array in a state table row.

RBBI_8BITS_ROWSback to summary
public static final int RBBI_8BITS_ROWS
RBBI_BOF_REQUIREDback to summary
public static final int RBBI_BOF_REQUIRED
RBBI_LOOKAHEAD_HARD_BREAKback to summary
public static final int RBBI_LOOKAHEAD_HARD_BREAK
TAGSIDXback to summary
public static final int TAGSIDX

offset to the "tagIndex" field in a state table row.

Constructor Detail

RBBIDataWrapperback to summary
pack-priv RBBIDataWrapper()

Method Detail

charToStringback to summary
public static String charToString(char n, int width)
dumpback to summary
public void dump(PrintStream out)

Debug function to display the break iterator data.

dumpCharCategoriesback to summary
private void dumpCharCategories(PrintStream out)
dumpRowback to summary
private void dumpRow(PrintStream out, RBBIDataWrapper.RBBIStateTable table, char state)

Dump (for debug) a single row of an RBBI state table

dumpTableback to summary
private void dumpTable(PrintStream out, RBBIDataWrapper.RBBIStateTable table)

Dump a state table. (A full set of RBBI rules has 4 state tables.)

equalsback to summary
public static boolean equals(RBBIDataWrapper.RBBIStateTable left, RBBIDataWrapper.RBBIStateTable right)

Equals helper for state tables, including null handling.

getback to summary
public static RBBIDataWrapper get(ByteBuffer bytes) throws IOException

Get an RBBIDataWrapper from an InputStream onto a pre-compiled set of RBBI rules.

getRowIndexback to summary
public int getRowIndex(int state)

RBBI State Table Indexing Function. Given a state number, return the array index of the start of the state table row for that state.

intToHexStringback to summary
public static String intToHexString(int n, int width)

Fixed width int-to-string conversion.

intToStringback to summary
public static String intToString(int n, int width)

Fixed width int-to-string conversion.

com.ibm.icu.impl back to summary

private final Class RBBIDataWrapper.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
com.ibm.icu.impl back to summary

public final Class RBBIDataWrapper.RBBIDataHeader

extends Object
Class Inheritance

Data Header. A struct-like class with the fields from the RBBI data file header. Not intended for public use, declared public for testing purposes only.

Field Summary

Modifier and TypeField and Description
public int
fCatCount

the number of character categories.

pack-priv byte[]
pack-priv int
pack-priv int
pack-priv int
pack-priv int
pack-priv int
pack-priv int
pack-priv int
pack-priv int
pack-priv int
pack-priv int
pack-priv int
pack-priv int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fCatCountback to summary
public int fCatCount

the number of character categories.

fFormatVersionback to summary
pack-priv byte[] fFormatVersion
fFTableback to summary
pack-priv int fFTable
fFTableLenback to summary
pack-priv int fFTableLen
fLengthback to summary
pack-priv int fLength
fMagicback to summary
pack-priv int fMagic
fRTableback to summary
pack-priv int fRTable
fRTableLenback to summary
pack-priv int fRTableLen
fRuleSourceback to summary
pack-priv int fRuleSource
fRuleSourceLenback to summary
pack-priv int fRuleSourceLen
fStatusTableback to summary
pack-priv int fStatusTable
fStatusTableLenback to summary
pack-priv int fStatusTableLen
fTrieback to summary
pack-priv int fTrie
fTrieLenback to summary
pack-priv int fTrieLen

Constructor Detail

RBBIDataHeaderback to summary
public RBBIDataHeader()
com.ibm.icu.impl back to summary

public Class RBBIDataWrapper.RBBIStateTable

extends Object
Class Inheritance

A RBBI State Transition table, the form of the data used at run time in Java. These can be created from stored ICU data, or built from rules. The structure corresponds closely to struct RBBIStateTable in ICU4C.

Field Summary

Modifier and TypeField and Description
public int
fDictCategoriesStart

Char category number of the first dictionary char class, or the the largest category number + 1 if there are no dictionary categories.

public int
fFlags

Option Flags for this state table.

public static int
fHeaderSize

Length in bytes of the state table header, of all the int32 fields preceding fTable in the serialized form.

public int
fLookAheadResultsSize

Size of run-time array required for holding look-ahead results.

public int
fNumStates

Number of states (rows) in this table.

public int
fRowLen

Length of a table row in bytes.

public char[]
fTable

Linear array of next state values, accessed as short[state, char_class]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
other
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
pack-priv static RBBIDataWrapper.RBBIStateTable
get(ByteBuffer bytes, int length)

public int
Inherited from java.lang.Object:
clonefinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fDictCategoriesStartback to summary
public int fDictCategoriesStart

Char category number of the first dictionary char class, or the the largest category number + 1 if there are no dictionary categories.

fFlagsback to summary
public int fFlags

Option Flags for this state table.

fHeaderSizeback to summary
public static int fHeaderSize

Length in bytes of the state table header, of all the int32 fields preceding fTable in the serialized form.

fLookAheadResultsSizeback to summary
public int fLookAheadResultsSize

Size of run-time array required for holding look-ahead results. Indexed by row.fLookAhead.

fNumStatesback to summary
public int fNumStates

Number of states (rows) in this table.

fRowLenback to summary
public int fRowLen

Length of a table row in bytes. Note mismatch with table data, which is short[].

fTableback to summary
public char[] fTable

Linear array of next state values, accessed as short[state, char_class]

Constructor Detail

RBBIStateTableback to summary
public RBBIStateTable()

Method Detail

equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
other:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getback to summary
pack-priv static RBBIDataWrapper.RBBIStateTable get(ByteBuffer bytes, int length) throws IOException
putback to summary
public int put(DataOutputStream bytes) throws IOException