本文整理汇总了Java中sun.text.bidi.BidiBase类的典型用法代码示例。如果您正苦于以下问题:Java BidiBase类的具体用法?Java BidiBase怎么用?Java BidiBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BidiBase类属于sun.text.bidi包,在下文中一共展示了BidiBase类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Bidi
import sun.text.bidi.BidiBase; //导入依赖的package包/类
/**
* Create Bidi from the given text, embedding, and direction information.
* The embeddings array may be null. If present, the values represent embedding level
* information. Negative values from -1 to -61 indicate overrides at the absolute value
* of the level. Positive values from 1 to 61 indicate embeddings. Where values are
* zero, the base embedding level as determined by the base direction is assumed.
* @param text an array containing the paragraph of text to process.
* @param textStart the index into the text array of the start of the paragraph.
* @param embeddings an array containing embedding values for each character in the paragraph.
* This can be null, in which case it is assumed that there is no external embedding information.
* @param embStart the index into the embedding array of the start of the paragraph.
* @param paragraphLength the length of the paragraph in the text and embeddings arrays.
* @param flags a collection of flags that control the algorithm. The
* algorithm understands the flags DIRECTION_LEFT_TO_RIGHT, DIRECTION_RIGHT_TO_LEFT,
* DIRECTION_DEFAULT_LEFT_TO_RIGHT, and DIRECTION_DEFAULT_RIGHT_TO_LEFT.
* Other values are reserved.
*/
public Bidi(char[] text, int textStart, byte[] embeddings, int embStart, int paragraphLength, int flags) {
if (text == null) {
throw new IllegalArgumentException("text is null");
}
if (paragraphLength < 0) {
throw new IllegalArgumentException("bad length: " + paragraphLength);
}
if (textStart < 0 || paragraphLength > text.length - textStart) {
throw new IllegalArgumentException("bad range: " + textStart +
" length: " + paragraphLength +
" for text of length: " + text.length);
}
if (embeddings != null && (embStart < 0 || paragraphLength > embeddings.length - embStart)) {
throw new IllegalArgumentException("bad range: " + embStart +
" length: " + paragraphLength +
" for embeddings of length: " + text.length);
}
bidiBase = new BidiBase(text, textStart, embeddings, embStart, paragraphLength, flags);
}