Example #1
0
        //int startOfSST, startOfRecord;

        public SSTSerializer(IntMapper strings, int numStrings, int numUniqueStrings)
        {
            this.strings = strings;
            this.sstRecordHeader = new SSTRecordHeader(numStrings, numUniqueStrings);

            int infoRecs = ExtSSTRecord.GetNumberOfInfoRecsForStrings(strings.Size);
            this.bucketAbsoluteOffsets = new int[infoRecs];
            this.bucketRelativeOffsets = new int[infoRecs];
        }
        public void TestContinuationWithNoOverlap()
        {
            byte[] header = ReadSampleHexData("evencontinuation.txt", "header", FAKE_SID);
            byte[] continueBytes = ReadSampleHexData("evencontinuation.txt", "continue1", ContinueRecord.sid);
            RecordInputStream in1 = TestcaseRecordInputStream.Create(Concat(header, continueBytes));

            IntMapper<UnicodeString> strings = new IntMapper<UnicodeString>();
            SSTDeserializer deserializer = new SSTDeserializer(strings);
            deserializer.ManufactureStrings(2, in1);

            Assert.AreEqual("At a dinner party or", strings[0] + "");
            Assert.AreEqual("At a dinner party", strings[1] + "");
        }
        public void TestSpanRichTextToPlainText()
        {
            byte[] header = ReadSampleHexData("richtextdata.txt", "header", FAKE_SID);
            byte[] continueBytes = ReadSampleHexData("richtextdata.txt", "continue1", ContinueRecord.sid);
            RecordInputStream in1 = TestcaseRecordInputStream.Create(Concat(header, continueBytes));


            IntMapper<UnicodeString> strings = new IntMapper<UnicodeString>();
            SSTDeserializer deserializer = new SSTDeserializer(strings);
            deserializer.ManufactureStrings(1, in1);

            Assert.AreEqual("At a dinner party orAt At At ", strings[0] + "");
        }
Example #4
0
 private static UnicodeString GetUnicodeString(IntMapper<UnicodeString> strings, int index)
 {
     return (UnicodeString)strings[index];
 }
Example #5
0
 /**
  * default constructor
  */
 public SSTRecord()
 {
     field_1_num_strings = 0;
     field_2_num_unique_strings = 0;
     field_3_strings = new IntMapper();
     deserializer = new SSTDeserializer(field_3_strings);
 }
Example #6
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();
     deserializer = new SSTDeserializer(field_3_strings);
     deserializer.ManufactureStrings(field_2_num_unique_strings, in1);
 }
        public void TestStringAcross2Continuations()
        {
            byte[] header = ReadSampleHexData("stringacross2continuations.txt", "header", FAKE_SID);
            byte[] continue1 = ReadSampleHexData("stringacross2continuations.txt", "continue1", ContinueRecord.sid);
            byte[] continue2 = ReadSampleHexData("stringacross2continuations.txt", "continue2", ContinueRecord.sid);

            byte[] bytes = Concat(header, continue1);
            bytes = Concat(bytes, continue2);
            RecordInputStream in1 = TestcaseRecordInputStream.Create(bytes);

            IntMapper<UnicodeString> strings = new IntMapper<UnicodeString>();
            SSTDeserializer deserializer = new SSTDeserializer(strings);
            deserializer.ManufactureStrings(2, in1);

            Assert.AreEqual("At a dinner party or", strings[0] + "");
            Assert.AreEqual("At a dinner partyAt a dinner party", strings[1] + "");
        }
        public void TestExtendedStrings()
        {
            byte[] header = ReadSampleHexData("extendedtextstrings.txt", "rich-header", FAKE_SID);
            byte[] continueBytes = ReadSampleHexData("extendedtextstrings.txt", "rich-continue1", ContinueRecord.sid);
            RecordInputStream in1 = TestcaseRecordInputStream.Create(Concat(header, continueBytes));

            IntMapper<UnicodeString> strings = new IntMapper<UnicodeString>();
            SSTDeserializer deserializer = new SSTDeserializer(strings);
            deserializer.ManufactureStrings(1, in1);

            Assert.AreEqual("At a dinner party orAt At At ", strings[0].ToString());


            header = ReadSampleHexData("extendedtextstrings.txt", "norich-header", FAKE_SID);
            continueBytes = ReadSampleHexData("extendedtextstrings.txt", "norich-continue1", ContinueRecord.sid);
            in1 = TestcaseRecordInputStream.Create(Concat(header, continueBytes));

            strings = new IntMapper<UnicodeString>();
            deserializer = new SSTDeserializer(strings);
            deserializer.ManufactureStrings(1, in1);

            Assert.AreEqual("At a dinner party orAt At At ", strings[0] + "");
        }
 public SSTRecordSizeCalculator(IntMapper strings)
 {
     this.strings = strings;
 }
Example #10
0
 static public void AddToStringTable(IntMapper<UnicodeString> strings, UnicodeString str)
 {
     strings.Add(str);
 }
Example #11
0
 public SSTDeserializer(IntMapper<UnicodeString> strings)
 {
     this.strings = strings;
 }
Example #12
0
 public SSTDeserializer(IntMapper strings)
 {
     this.strings = strings;
 }