Ejemplo n.º 1
0
        // fix warning CS0169 "never used": int startOfSST, startOfRecord;

        public SSTSerializer(IntMapper <UnicodeString> strings, int numStrings, int numUniqueStrings)
        {
            this.strings      = strings;
            _numStrings       = numStrings;
            _numUniqueStrings = numUniqueStrings;

            int infoRecs = ExtSSTRecord.GetNumberOfInfoRecsForStrings(strings.Size);

            this.bucketAbsoluteOffsets = new int[infoRecs];
            this.bucketRelativeOffsets = new int[infoRecs];
        }
Ejemplo n.º 2
0
        /**
         * Creates an extended string record based on the current contents of
         * the current SST record.  The offset within the stream to the SST record
         * Is required because the extended string record points directly to the
         * strings in the SST record.
         *
         * NOTE: THIS FUNCTION MUST ONLY BE CALLED AFTER THE SST RECORD HAS BEEN
         *       SERIALIZED.
         *
         * @param sstOffset     The offset in the stream to the start of the
         *                      SST record.
         * @return  The new SST record.
         */
        public ExtSSTRecord CreateExtSSTRecord(int sstOffset)
        {
            if (bucketAbsoluteOffsets == null || bucketAbsoluteOffsets == null)
            {
                throw new InvalidOperationException("SST record has not yet been Serialized.");
            }

            ExtSSTRecord extSST = new ExtSSTRecord();

            extSST.NumStringsPerBucket = ((short)8);
            int[] absoluteOffsets = (int[])bucketAbsoluteOffsets.Clone();
            int[] relativeOffsets = (int[])bucketRelativeOffsets.Clone();
            for (int i = 0; i < absoluteOffsets.Length; i++)
            {
                absoluteOffsets[i] += sstOffset;
            }
            extSST.SetBucketOffsets(absoluteOffsets, relativeOffsets);
            return(extSST);
        }
Ejemplo n.º 3
0
        /**
         * Creates an extended string record based on the current contents of
         * the current SST record.  The offset within the stream to the SST record
         * Is required because the extended string record points directly to the
         * strings in the SST record.
         * 
         * NOTE: THIS FUNCTION MUST ONLY BE CALLED AFTER THE SST RECORD HAS BEEN
         *       SERIALIZED.
         *
         * @param sstOffset     The offset in the stream to the start of the
         *                      SST record.
         * @return  The new SST record.
         */
        public ExtSSTRecord CreateExtSSTRecord(int sstOffset)
        {
            if (bucketAbsoluteOffsets == null || bucketAbsoluteOffsets == null)
                throw new InvalidOperationException("SST record has not yet been Serialized.");

            ExtSSTRecord extSST = new ExtSSTRecord();
            extSST.NumStringsPerBucket=((short)8);
            int[] absoluteOffsets = (int[])bucketAbsoluteOffsets.Clone();
            int[] relativeOffsets = (int[])bucketRelativeOffsets.Clone();
            for (int i = 0; i < absoluteOffsets.Length; i++)
                absoluteOffsets[i] += sstOffset;
            extSST.SetBucketOffsets(absoluteOffsets, relativeOffsets);
            return extSST;
        }
Ejemplo n.º 4
0
 /**
  * Calculates the size in bytes of the EXTSST record as it would be if the
  * record was Serialized.
  *
  * @return  The size of the ExtSST record in bytes.
  */
 public int CalcExtSSTRecordSize()
 {
     return(ExtSSTRecord.GetRecordSizeForStrings(field_3_strings.Size));
 }
Ejemplo n.º 5
0
        /**
         * Creates the ExtendedSST record with numstrings per bucket Set to 0x8.  HSSF
         * doesn't yet know what to do with this thing, but we Create it with nothing in
         * it hardly just to make Excel happy and our sheets look like Excel's
         *
         * @return record containing an ExtSSTRecord
         * @see org.apache.poi.hssf.record.ExtSSTRecord
         * @see org.apache.poi.hssf.record.Record
         */

        private static Record CreateExtendedSST()
        {
            ExtSSTRecord retval = new ExtSSTRecord();

            retval.NumStringsPerBucket=((short)0x8);
            return retval;
        }