Java Code Examples for com.sun.xml.internal.fastinfoset.util.StringIntMap#get()

The following examples show how to use com.sun.xml.internal.fastinfoset.util.StringIntMap#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Encoder.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 s the string to encode
 * @param map the vocabulary table of strings to indexes.
 * @param addToTable true if the string could be added to the vocabulary
 *                   table (if table has enough memory)
 * @param mustBeAddedToTable true if the string must be added to the vocabulary
 *                   table (if not already present in the table).
 */
protected final void encodeNonIdentifyingStringOnFirstBit(String s, StringIntMap map,
        boolean addToTable, boolean mustBeAddedToTable) throws IOException {
    if (s == null || s.length() == 0) {
        // C.26 an index (first bit '1') with seven '1' bits for an empty string
        write(0xFF);
    } else {
        if (addToTable || mustBeAddedToTable) {
            // if attribute value could be added to table
            boolean canAddAttributeToTable = mustBeAddedToTable ||
                    canAddAttributeToTable(s.length());

            // obtain/get index
            int index = canAddAttributeToTable ?
                map.obtainIndex(s) :
                map.get(s);

            if (index != KeyIntMap.NOT_PRESENT) {
                // if attribute value is in table
                encodeNonZeroIntegerOnSecondBitFirstBitOne(index);
            } else if (canAddAttributeToTable) {
                // if attribute value is not in table, but could be added
                _b = EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG |
                        _nonIdentifyingStringOnFirstBitCES;
                encodeNonEmptyCharacterStringOnFifthBit(s);
            } else {
                // if attribute value is not in table and could not be added
                _b = _nonIdentifyingStringOnFirstBitCES;
                encodeNonEmptyCharacterStringOnFifthBit(s);
            }
        } else {
            _b = _nonIdentifyingStringOnFirstBitCES;
            encodeNonEmptyCharacterStringOnFifthBit(s);
        }
    }
}
 
Example 2
Source File: Encoder.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 s the string to encode
 * @param map the vocabulary table of strings to indexes.
 * @param addToTable true if the string could be added to the vocabulary
 *                   table (if table has enough memory)
 * @param mustBeAddedToTable true if the string must be added to the vocabulary
 *                   table (if not already present in the table).
 */
protected final void encodeNonIdentifyingStringOnFirstBit(String s, StringIntMap map,
        boolean addToTable, boolean mustBeAddedToTable) throws IOException {
    if (s == null || s.length() == 0) {
        // C.26 an index (first bit '1') with seven '1' bits for an empty string
        write(0xFF);
    } else {
        if (addToTable || mustBeAddedToTable) {
            // if attribute value could be added to table
            boolean canAddAttributeToTable = mustBeAddedToTable ||
                    canAddAttributeToTable(s.length());

            // obtain/get index
            int index = canAddAttributeToTable ?
                map.obtainIndex(s) :
                map.get(s);

            if (index != KeyIntMap.NOT_PRESENT) {
                // if attribute value is in table
                encodeNonZeroIntegerOnSecondBitFirstBitOne(index);
            } else if (canAddAttributeToTable) {
                // if attribute value is not in table, but could be added
                _b = EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG |
                        _nonIdentifyingStringOnFirstBitCES;
                encodeNonEmptyCharacterStringOnFifthBit(s);
            } else {
                // if attribute value is not in table and could not be added
                _b = _nonIdentifyingStringOnFirstBitCES;
                encodeNonEmptyCharacterStringOnFifthBit(s);
            }
        } else {
            _b = _nonIdentifyingStringOnFirstBitCES;
            encodeNonEmptyCharacterStringOnFifthBit(s);
        }
    }
}
 
Example 3
Source File: Encoder.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 s the string to encode
 * @param map the vocabulary table of strings to indexes.
 * @param addToTable true if the string could be added to the vocabulary
 *                   table (if table has enough memory)
 * @param mustBeAddedToTable true if the string must be added to the vocabulary
 *                   table (if not already present in the table).
 */
protected final void encodeNonIdentifyingStringOnFirstBit(String s, StringIntMap map,
        boolean addToTable, boolean mustBeAddedToTable) throws IOException {
    if (s == null || s.length() == 0) {
        // C.26 an index (first bit '1') with seven '1' bits for an empty string
        write(0xFF);
    } else {
        if (addToTable || mustBeAddedToTable) {
            // if attribute value could be added to table
            boolean canAddAttributeToTable = mustBeAddedToTable ||
                    canAddAttributeToTable(s.length());

            // obtain/get index
            int index = canAddAttributeToTable ?
                map.obtainIndex(s) :
                map.get(s);

            if (index != KeyIntMap.NOT_PRESENT) {
                // if attribute value is in table
                encodeNonZeroIntegerOnSecondBitFirstBitOne(index);
            } else if (canAddAttributeToTable) {
                // if attribute value is not in table, but could be added
                _b = EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG |
                        _nonIdentifyingStringOnFirstBitCES;
                encodeNonEmptyCharacterStringOnFifthBit(s);
            } else {
                // if attribute value is not in table and could not be added
                _b = _nonIdentifyingStringOnFirstBitCES;
                encodeNonEmptyCharacterStringOnFifthBit(s);
            }
        } else {
            _b = _nonIdentifyingStringOnFirstBitCES;
            encodeNonEmptyCharacterStringOnFifthBit(s);
        }
    }
}
 
Example 4
Source File: Encoder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 s the string to encode
 * @param map the vocabulary table of strings to indexes.
 * @param addToTable true if the string could be added to the vocabulary
 *                   table (if table has enough memory)
 * @param mustBeAddedToTable true if the string must be added to the vocabulary
 *                   table (if not already present in the table).
 */
protected final void encodeNonIdentifyingStringOnFirstBit(String s, StringIntMap map,
        boolean addToTable, boolean mustBeAddedToTable) throws IOException {
    if (s == null || s.length() == 0) {
        // C.26 an index (first bit '1') with seven '1' bits for an empty string
        write(0xFF);
    } else {
        if (addToTable || mustBeAddedToTable) {
            // if attribute value could be added to table
            boolean canAddAttributeToTable = mustBeAddedToTable ||
                    canAddAttributeToTable(s.length());

            // obtain/get index
            int index = canAddAttributeToTable ?
                map.obtainIndex(s) :
                map.get(s);

            if (index != KeyIntMap.NOT_PRESENT) {
                // if attribute value is in table
                encodeNonZeroIntegerOnSecondBitFirstBitOne(index);
            } else if (canAddAttributeToTable) {
                // if attribute value is not in table, but could be added
                _b = EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG |
                        _nonIdentifyingStringOnFirstBitCES;
                encodeNonEmptyCharacterStringOnFifthBit(s);
            } else {
                // if attribute value is not in table and could not be added
                _b = _nonIdentifyingStringOnFirstBitCES;
                encodeNonEmptyCharacterStringOnFifthBit(s);
            }
        } else {
            _b = _nonIdentifyingStringOnFirstBitCES;
            encodeNonEmptyCharacterStringOnFifthBit(s);
        }
    }
}
 
Example 5
Source File: Encoder.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 s the string to encode
 * @param map the vocabulary table of strings to indexes.
 * @param addToTable true if the string could be added to the vocabulary
 *                   table (if table has enough memory)
 * @param mustBeAddedToTable true if the string must be added to the vocabulary
 *                   table (if not already present in the table).
 */
protected final void encodeNonIdentifyingStringOnFirstBit(String s, StringIntMap map,
        boolean addToTable, boolean mustBeAddedToTable) throws IOException {
    if (s == null || s.length() == 0) {
        // C.26 an index (first bit '1') with seven '1' bits for an empty string
        write(0xFF);
    } else {
        if (addToTable || mustBeAddedToTable) {
            // if attribute value could be added to table
            boolean canAddAttributeToTable = mustBeAddedToTable ||
                    canAddAttributeToTable(s.length());

            // obtain/get index
            int index = canAddAttributeToTable ?
                map.obtainIndex(s) :
                map.get(s);

            if (index != KeyIntMap.NOT_PRESENT) {
                // if attribute value is in table
                encodeNonZeroIntegerOnSecondBitFirstBitOne(index);
            } else if (canAddAttributeToTable) {
                // if attribute value is not in table, but could be added
                _b = EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG |
                        _nonIdentifyingStringOnFirstBitCES;
                encodeNonEmptyCharacterStringOnFifthBit(s);
            } else {
                // if attribute value is not in table and could not be added
                _b = _nonIdentifyingStringOnFirstBitCES;
                encodeNonEmptyCharacterStringOnFifthBit(s);
            }
        } else {
            _b = _nonIdentifyingStringOnFirstBitCES;
            encodeNonEmptyCharacterStringOnFifthBit(s);
        }
    }
}
 
Example 6
Source File: Encoder.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 s the string to encode
 * @param map the vocabulary table of strings to indexes.
 * @param addToTable true if the string could be added to the vocabulary
 *                   table (if table has enough memory)
 * @param mustBeAddedToTable true if the string must be added to the vocabulary
 *                   table (if not already present in the table).
 */
protected final void encodeNonIdentifyingStringOnFirstBit(String s, StringIntMap map,
        boolean addToTable, boolean mustBeAddedToTable) throws IOException {
    if (s == null || s.length() == 0) {
        // C.26 an index (first bit '1') with seven '1' bits for an empty string
        write(0xFF);
    } else {
        if (addToTable || mustBeAddedToTable) {
            // if attribute value could be added to table
            boolean canAddAttributeToTable = mustBeAddedToTable ||
                    canAddAttributeToTable(s.length());

            // obtain/get index
            int index = canAddAttributeToTable ?
                map.obtainIndex(s) :
                map.get(s);

            if (index != KeyIntMap.NOT_PRESENT) {
                // if attribute value is in table
                encodeNonZeroIntegerOnSecondBitFirstBitOne(index);
            } else if (canAddAttributeToTable) {
                // if attribute value is not in table, but could be added
                _b = EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG |
                        _nonIdentifyingStringOnFirstBitCES;
                encodeNonEmptyCharacterStringOnFifthBit(s);
            } else {
                // if attribute value is not in table and could not be added
                _b = _nonIdentifyingStringOnFirstBitCES;
                encodeNonEmptyCharacterStringOnFifthBit(s);
            }
        } else {
            _b = _nonIdentifyingStringOnFirstBitCES;
            encodeNonEmptyCharacterStringOnFifthBit(s);
        }
    }
}
 
Example 7
Source File: Encoder.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 s the string to encode
 * @param map the vocabulary table of strings to indexes.
 * @param addToTable true if the string could be added to the vocabulary
 *                   table (if table has enough memory)
 * @param mustBeAddedToTable true if the string must be added to the vocabulary
 *                   table (if not already present in the table).
 */
protected final void encodeNonIdentifyingStringOnFirstBit(String s, StringIntMap map,
        boolean addToTable, boolean mustBeAddedToTable) throws IOException {
    if (s == null || s.length() == 0) {
        // C.26 an index (first bit '1') with seven '1' bits for an empty string
        write(0xFF);
    } else {
        if (addToTable || mustBeAddedToTable) {
            // if attribute value could be added to table
            boolean canAddAttributeToTable = mustBeAddedToTable ||
                    canAddAttributeToTable(s.length());

            // obtain/get index
            int index = canAddAttributeToTable ?
                map.obtainIndex(s) :
                map.get(s);

            if (index != KeyIntMap.NOT_PRESENT) {
                // if attribute value is in table
                encodeNonZeroIntegerOnSecondBitFirstBitOne(index);
            } else if (canAddAttributeToTable) {
                // if attribute value is not in table, but could be added
                _b = EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG |
                        _nonIdentifyingStringOnFirstBitCES;
                encodeNonEmptyCharacterStringOnFifthBit(s);
            } else {
                // if attribute value is not in table and could not be added
                _b = _nonIdentifyingStringOnFirstBitCES;
                encodeNonEmptyCharacterStringOnFifthBit(s);
            }
        } else {
            _b = _nonIdentifyingStringOnFirstBitCES;
            encodeNonEmptyCharacterStringOnFifthBit(s);
        }
    }
}
 
Example 8
Source File: Encoder.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 s the string to encode
 * @param map the vocabulary table of strings to indexes.
 * @param addToTable true if the string could be added to the vocabulary
 *                   table (if table has enough memory)
 * @param mustBeAddedToTable true if the string must be added to the vocabulary
 *                   table (if not already present in the table).
 */
protected final void encodeNonIdentifyingStringOnFirstBit(String s, StringIntMap map,
        boolean addToTable, boolean mustBeAddedToTable) throws IOException {
    if (s == null || s.length() == 0) {
        // C.26 an index (first bit '1') with seven '1' bits for an empty string
        write(0xFF);
    } else {
        if (addToTable || mustBeAddedToTable) {
            // if attribute value could be added to table
            boolean canAddAttributeToTable = mustBeAddedToTable ||
                    canAddAttributeToTable(s.length());

            // obtain/get index
            int index = canAddAttributeToTable ?
                map.obtainIndex(s) :
                map.get(s);

            if (index != KeyIntMap.NOT_PRESENT) {
                // if attribute value is in table
                encodeNonZeroIntegerOnSecondBitFirstBitOne(index);
            } else if (canAddAttributeToTable) {
                // if attribute value is not in table, but could be added
                _b = EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG |
                        _nonIdentifyingStringOnFirstBitCES;
                encodeNonEmptyCharacterStringOnFifthBit(s);
            } else {
                // if attribute value is not in table and could not be added
                _b = _nonIdentifyingStringOnFirstBitCES;
                encodeNonEmptyCharacterStringOnFifthBit(s);
            }
        } else {
            _b = _nonIdentifyingStringOnFirstBitCES;
            encodeNonEmptyCharacterStringOnFifthBit(s);
        }
    }
}