当前位置: 首页>>代码示例>>Java>>正文


Java CharArrayIntMap.get方法代码示例

本文整理汇总了Java中com.sun.xml.internal.fastinfoset.util.CharArrayIntMap.get方法的典型用法代码示例。如果您正苦于以下问题:Java CharArrayIntMap.get方法的具体用法?Java CharArrayIntMap.get怎么用?Java CharArrayIntMap.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.xml.internal.fastinfoset.util.CharArrayIntMap的用法示例。


在下文中一共展示了CharArrayIntMap.get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: encodeNonIdentifyingStringOnFirstBit

import com.sun.xml.internal.fastinfoset.util.CharArrayIntMap; //导入方法依赖的package包/类
/**
 * Encode a non identifying string on the first bit of an octet.
 * Implementation of clause C.14 of ITU-T Rec. X.891 | ISO/IEC 24824-1.
 *
 * @param ch the array of characters.
 * @param offset the offset into the array of characters.
 * @param length the length of characters.
 * @param map the vocabulary table of character arrays to indexes.
 * @param addToTable true if the string should be added to the vocabulary
 *                   table (if not already present in the table).
 * @param clone true if the array of characters should be cloned if added
 *              to the vocabulary table.
 */
protected final void encodeNonIdentifyingStringOnFirstBit(char[] ch, int offset, int length, CharArrayIntMap map,
        boolean addToTable, boolean clone) throws IOException {
    if (length == 0) {
        // C.26 an index (first bit '1') with seven '1' bits for an empty string
        write(0xFF);
    } else {
        if (addToTable) {
            // if char array could be added to table
            boolean canAddCharacterContentToTable =
                    canAddCharacterContentToTable(length, map);

            // obtain/get index
            int index = canAddCharacterContentToTable ?
                map.obtainIndex(ch, offset, length, clone) :
                map.get(ch, offset, length);

            if (index != KeyIntMap.NOT_PRESENT) {
                // if char array is in table
                encodeNonZeroIntegerOnSecondBitFirstBitOne(index);
            } else if (canAddCharacterContentToTable) {
                // if char array is not in table, but could be added
                _b = EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG |
                        _nonIdentifyingStringOnFirstBitCES;
                encodeNonEmptyCharacterStringOnFifthBit(ch, offset, length);
            } else {
                // if char array is not in table and could not be added
                _b = _nonIdentifyingStringOnFirstBitCES;
                encodeNonEmptyCharacterStringOnFifthBit(ch, offset, length);
            }
        } else {
            _b = _nonIdentifyingStringOnFirstBitCES;
            encodeNonEmptyCharacterStringOnFifthBit(ch, offset, length);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:49,代码来源:Encoder.java

示例2: encodeNonIdentifyingStringOnThirdBit

import com.sun.xml.internal.fastinfoset.util.CharArrayIntMap; //导入方法依赖的package包/类
/**
 * Encode a non identifying string on the third bit of an octet.
 * Implementation of clause C.15 of ITU-T Rec. X.891 | ISO/IEC 24824-1.
 *
 * @param ch the array of characters.
 * @param offset the offset into the array of characters.
 * @param length the length of characters.
 * @param map the vocabulary table of character arrays to indexes.
 * @param addToTable true if the array of characters should be added to the vocabulary
 *                   table (if not already present in the table).
 * @param clone true if the array of characters should be cloned if added
 *              to the vocabulary table.
 */
protected final void encodeNonIdentifyingStringOnThirdBit(char[] ch, int offset, int length,
        CharArrayIntMap map, boolean addToTable, boolean clone) throws IOException {
    // length cannot be zero since sequence of CIIs has to be > 0

    if (addToTable) {
        // if char array could be added to table
        boolean canAddCharacterContentToTable =
                canAddCharacterContentToTable(length, map);

        // obtain/get index
        int index = canAddCharacterContentToTable ?
            map.obtainIndex(ch, offset, length, clone) :
            map.get(ch, offset, length);

        if (index != KeyIntMap.NOT_PRESENT) {
            // if char array is in table
            _b = EncodingConstants.CHARACTER_CHUNK | 0x20;
            encodeNonZeroIntegerOnFourthBit(index);
        } else if (canAddCharacterContentToTable) {
            // if char array is not in table, but could be added
            _b = EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG |
                    _nonIdentifyingStringOnThirdBitCES;
            encodeNonEmptyCharacterStringOnSeventhBit(ch, offset, length);
        } else {
            // if char array is not in table and could not be added
                _b = _nonIdentifyingStringOnThirdBitCES;
                encodeNonEmptyCharacterStringOnSeventhBit(ch, offset, length);
        }
    } else {
        // char array will not be added to map
        _b = _nonIdentifyingStringOnThirdBitCES;
        encodeNonEmptyCharacterStringOnSeventhBit(ch, offset, length);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:48,代码来源:Encoder.java


注:本文中的com.sun.xml.internal.fastinfoset.util.CharArrayIntMap.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。