Beispiel #1
0
 public void Serialize <T>(T obj, Stream stream) where T : INamedList
 {
     try
     {
         var converter = new SolrJavaBinConverter();
         converter.WriteJavaBin(obj, stream);
     }
     catch (Exception e)
     {
         throw new MizoreSerializationException("Exception during Serialization.", this, e);
     }
 }
Beispiel #2
0
 public INamedList Deserialize(Stream stream)
 {
     try
     {
         var converter = new SolrJavaBinConverter();
         return(converter.ReadJavaBin(stream) as INamedList);
     }
     catch (Exception e)
     {
         throw new MizoreSerializationException("Exception during Deserialization.", this, e);
     }
 }
Beispiel #3
0
        public static void Main(string[] args)
        {
            var solrBackCompTestfile = File.ReadAllBytes(@"..\..\TestJavaBin\javabin_backcompat.bin");
            var myJB = new SolrJavaBinConverter();
            var myList = myJB.ReadJavaBin(new MemoryStream(solrBackCompTestfile));
            myJB = new SolrJavaBinConverter();
            var ms = new MemoryStream();
            myJB.WriteJavaBin(myList, ms);
            File.WriteAllBytes(@"..\..\TestJavaBin\javabin_backcompat-test.bin", ms.ToArray());
            var solrBackCompTestfile2 = File.ReadAllBytes(@"..\..\TestJavaBin\javabin_backcompat-test.bin");
            myJB = new SolrJavaBinConverter();
            var myList2 = myJB.ReadJavaBin(new MemoryStream(solrBackCompTestfile));
            myJB = new SolrJavaBinConverter();
            var ms2 = new MemoryStream();
            myJB.WriteJavaBin(myList2, ms2);
            File.WriteAllBytes(@"..\..\TestJavaBin\javabin_backcompat-test2.bin", ms.ToArray());

            //var javabin = File.ReadAllBytes(@"..\..\..\MizoreTests\Resources\ResponseFiles\ping.javabin");
            //var javabin = File.ReadAllBytes(@"..\..\TestJavaBin\selectAllExampleDocs.bin");
            //for (int i = 0; i < 10000; i++)
            //    Parse(javabin);
        }