Exemplo n.º 1
0
 /**
  * default constructor
  */
 public SSTRecord()
 {
     field_1_num_strings        = 0;
     field_2_num_unique_strings = 0;
     field_3_strings            = new IntMapper <UnicodeString>();
     deserializer = new SSTDeserializer(field_3_strings);
 }
Exemplo n.º 2
0
        /**
         * Constructs an SST record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public SSTRecord(RecordInputStream in1)
        {
            // this method Is ALWAYS called after construction -- using
            // the nontrivial constructor, of course -- so this Is where
            // we initialize our fields
            field_1_num_strings        = in1.ReadInt();
            field_2_num_unique_strings = in1.ReadInt();
            field_3_strings            = new IntMapper <UnicodeString>();
            deserializer = new SSTDeserializer(field_3_strings);
            deserializer.ManufactureStrings(field_2_num_unique_strings, in1);
        }
Exemplo n.º 3
0
        /**
         * Add a string.
         *
         * @param string string to be Added
         *
         * @return the index of that string in the table
         */

        public int AddString(UnicodeString str)
        {
            field_1_num_strings++;
            UnicodeString ucs = (str == null) ? EMPTY_STRING
                    : str;
            int rval;
            int index = field_3_strings.GetIndex(ucs);

            if (index != -1)
            {
                rval = index;
            }
            else
            {
                // This is a new string -- we didn't see it among the
                // strings we've already collected
                rval = field_3_strings.Size;
                field_2_num_unique_strings++;
                SSTDeserializer.AddToStringTable(field_3_strings, ucs);
            }
            return(rval);
        }