コード例 #1
0
ファイル: MimeUtilTest.cs プロジェクト: cip4/JDFLibNet
 public virtual void testURLPerformance()
 {
     // testWritePerformance();
     try
     {
         long write = JDFDate.ToMillisecs(DateTime.Now);
         AttachmentCollection mp = MimeUtil.GetMultiPart(sm_dirTestDataTemp + "performance.mjm");
         long getMP = JDFDate.ToMillisecs(DateTime.Now);
         Console.WriteLine("get multipart time: " + (getMP - write));
         Attachment bp     = MimeUtil.GetPartByCID(mp, "bigger.pdf");
         long       getCID = JDFDate.ToMillisecs(DateTime.Now);
         Console.WriteLine("get big time: " + (getCID - getMP));
         Assert.IsNotNull(bp);
         Assert.AreEqual("bigger.pdf", bp.Name);
         HttpWebRequest uc  = MimeUtil.writeToURL(mp, "http://localhost:8080/JDFUtility/dump");
         Stream         @is = uc.GetRequestStream();
         IOUtils.CopyStream(@is, System.Console.OpenStandardOutput());
         @is.Close();
         Console.WriteLine();
         // System.out.println("extracted "+l+" bytes in time: "+(extract-
         // getCID));
         long extract = JDFDate.ToMillisecs(DateTime.Now);
         Console.WriteLine("sent  bytes in time: " + (extract - getCID));
     }
     catch (Exception)
     {
         // nop
     }
 }
コード例 #2
0
ファイル: MimeUtilTest.cs プロジェクト: cip4/JDFLibNet
        public virtual void testWriteToURLFile()
        {
            testBuildMimePackageDocJMF();

            AttachmentCollection mp = MimeUtil.GetMultiPart(sm_dirTestDataTemp + "testMimePackageDoc.mjm");
            FileInfo             f1 = new FileInfo(sm_dirTestDataTemp + "testMimePackageDoc3.mjm");

            MimeUtil.writeToURL(mp, UrlUtil.fileToUrl(f1, false));
            FileInfo f2 = new FileInfo(sm_dirTestDataTemp + "testMimePackageDoc.mjm");

            Assert.IsTrue(f1.Exists);
            Assert.AreEqual(f1.Length, f2.Length, 100);
        }