/** * 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); }
/** * 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); }
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] + ""); }
/** * 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); }
/** * 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); }
/** * 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] + ""); }