예제 #1
0
        // protected constructor ---------------------------------------------

        /// <summary>
        /// TrieEnumeration constructor
        /// </summary>
        ///
        /// <param name="property">the unicode character properties to be used</param>
        /// @draft 2.1
        protected internal UCharacterTypeIterator(UCharacterProperty property) : base(property.m_trie_)
        {
        }
        // protected methods -------------------------------------------------

        /// <summary>
        /// <p>
        /// Reads uprops.icu, parse it into blocks of data to be stored in
        /// UCharacterProperty.
        /// </P
        /// </summary>
        ///
        /// <param name="ucharppty">UCharacterProperty instance</param>
        /// <exception cref="IOException">thrown when data reading fails</exception>
        /// @draft 2.1
        protected internal void Read(UCharacterProperty ucharppty)
        {
            // read the indexes
            int count = INDEX_SIZE_;

            m_propertyOffset_ = m_dataInputStream_.ReadInt();
            count--;
            m_exceptionOffset_ = m_dataInputStream_.ReadInt();
            count--;
            m_caseOffset_ = m_dataInputStream_.ReadInt();
            count--;
            m_additionalOffset_ = m_dataInputStream_.ReadInt();
            count--;
            m_additionalVectorsOffset_ = m_dataInputStream_.ReadInt();
            count--;
            m_additionalColumnsCount_ = m_dataInputStream_.ReadInt();
            count--;
            m_reservedOffset_ = m_dataInputStream_.ReadInt();
            count--;
            m_dataInputStream_.SkipBytes(3 << 2);
            count -= 3;
            ucharppty.m_maxBlockScriptValue_ = m_dataInputStream_.ReadInt();
            count--;     // 10
            ucharppty.m_maxJTGValue_ = m_dataInputStream_.ReadInt();
            count--;     // 11
            m_dataInputStream_.SkipBytes(count << 2);

            // read the trie index block
            // m_props_index_ in terms of ints
            ucharppty.m_trie_ = new CharTrie(m_dataInputStream_, null);

            // skip the 32 bit properties block
            int size = m_exceptionOffset_ - m_propertyOffset_;

            m_dataInputStream_.SkipBytes(size * 4);

            // reads the 32 bit exceptions block
            size = m_caseOffset_ - m_exceptionOffset_;
            m_dataInputStream_.SkipBytes(size * 4);

            // reads the 32 bit case block
            size = (m_additionalOffset_ - m_caseOffset_) << 1;
            m_dataInputStream_.SkipBytes(size * 2);

            if (m_additionalColumnsCount_ > 0)
            {
                // reads the additional property block
                ucharppty.m_additionalTrie_ = new CharTrie(m_dataInputStream_, null);

                // additional properties
                size = m_reservedOffset_ - m_additionalVectorsOffset_;
                ucharppty.m_additionalVectors_ = new int[size];
                for (int i = 0; i < size; i++)
                {
                    ucharppty.m_additionalVectors_[i] = m_dataInputStream_
                                                        .ReadInt();
                }
            }

            //m_dataInputStream_.Close();
            ucharppty.m_additionalColumnsCount_ = m_additionalColumnsCount_;
            ucharppty.m_unicodeVersion_         = IBM.ICU.Util.VersionInfo.GetInstance(
                (int)m_unicodeVersion_[0], (int)m_unicodeVersion_[1],
                (int)m_unicodeVersion_[2], (int)m_unicodeVersion_[3]);
        }
예제 #3
0
        // public methods --------------------------------------------------

        /// <summary>
        /// Java friend implementation To store the index and data array into the
        /// argument.
        /// </summary>
        ///
        /// <param name="friend">java friend UCharacterProperty object to store the array</param>
        public void PutIndexData(UCharacterProperty friend)
        {
            friend.SetIndexData(m_friendAgent_);
        }