zoukankan      html  css  js  c++  java
  • zip压缩文件测试

    http://tech.it168.com/a2009/0604/583/000000583382_5.shtml

    //webmethod序列化数据
            privatevoid btnSerial_Click(object sender, EventArgs e)
            {
               
    try
                {
                   
    this.dtGrid.DataSource =null;
                    DataSet ds
    =new DataSet();
                    DateTime dtBegin
    = DateTime.Now;
                   
    byte[] datas = ws.GetDataSetBytes();
                    DateTime dtDown
    = DateTime.Now;

                    ds
    = (DataSet)ComZipClass.zip.objXmlDeserialize(datas, typeof(DataSet));
                    DateTime dtSerial
    = DateTime.Now;
                   
    this.dtGrid.DataSource = ds.Tables[0];
                    MessageBox.Show(
    string.Format("下载耗时:{0},解压序列化数据耗时:{1},绑定数据耗时:{2},数据量:{3}",
                    dtDown
    - dtBegin,dtSerial-dtDown, DateTime.Now - dtDown, datas.Length));
                }
               
    catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
           
    //序列化并压缩BZIP后数据
            privatevoid btnBZip_Click(object sender, EventArgs e)
            {
               
    try
                {
                   
    this.dtGrid.DataSource =null;
                    DataSet ds
    =new DataSet();
                    DateTime dtBegin
    = DateTime.Now;
                   
    byte[] datas = ws.GetBZiipCompress();
                    DateTime dtDown
    = DateTime.Now;
                   
    byte[] uzip = ComZipClass.zip.BZipDeCompress(datas);
                    DateTime dtUnzip
    = DateTime.Now;
                    ds
    = (DataSet)ComZipClass.zip.objXmlDeserialize(uzip, typeof(DataSet));
                    DateTime dtSerial
    = DateTime.Now;
                   
    this.dtGrid.DataSource = ds.Tables[0];
                     MessageBox.Show(
    string.Format("下载耗时:{0},解压BZIP耗时:{1},解压序列化耗时:{2},绑定数据耗时:{3},数据量:{4}",
                    dtDown
    - dtBegin, dtUnzip - dtDown, dtSerial - dtUnzip, DateTime.Now - dtSerial, datas.Length));
                }
               
    catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
           
    //序列化并压缩Deflate后数据
            privatevoid btnDeflater_Click(object sender, EventArgs e)
            {
               
    try
                {
                   
    this.dtGrid.DataSource =null;
                    DataSet ds
    =new DataSet();
                    DateTime dtBegin
    = DateTime.Now;
                   
    byte[] datas = ws.GetDeflaterCompress();
                    DateTime dtDown
    = DateTime.Now;
                   
    byte[] uzip = ComZipClass.zip.DeflaterDeCompress(datas);
                    DateTime dtUnzip
    = DateTime.Now;
                    ds
    = (DataSet)ComZipClass.zip.objXmlDeserialize(uzip, typeof(DataSet));
                    DateTime dtSerial
    = DateTime.Now;
                   
    this.dtGrid.DataSource = ds.Tables[0];
                    MessageBox.Show(
    string.Format("下载耗时:{0},解压Deflater耗时:{1},解压序列化耗时:{2},绑定数据耗时:{3},数据量:{4}",
                   dtDown
    - dtBegin, dtUnzip - dtDown, dtSerial - dtUnzip, DateTime.Now - dtSerial, datas.Length));
                }
               
    catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
           
    //序列化并压缩GZIP后数据
            privatevoid btnGZip_Click(object sender, EventArgs e)
            {
               
    try
                {
                   
    this.dtGrid.DataSource =null;
                    DataSet ds
    =new DataSet();
                    DateTime dtBegin
    = DateTime.Now;
                   
    byte[] datas = ws.GetGZipCompress();
                    DateTime dtDown
    = DateTime.Now;
                   
    byte[] uzip = ComZipClass.zip.GZipDeCompress(datas);
                    DateTime dtUnzip
    = DateTime.Now;
                    ds
    = (DataSet)ComZipClass.zip.objXmlDeserialize(uzip, typeof(DataSet));
                    DateTime dtSerial
    = DateTime.Now;
                   
    this.dtGrid.DataSource = ds.Tables[0];
                    MessageBox.Show(
    string.Format("下载耗时:{0},解压GZIP耗时:{1},解压序列化耗时:{2},绑定数据耗时:{3},数据量:{4}",
                   dtDown
    - dtBegin, dtUnzip - dtDown, dtSerial - dtUnzip, DateTime.Now - dtSerial, datas.Length));
                }
               
    catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
           
    //序列化并压缩ZIP后数据
            privatevoid btnZip_Click(object sender, EventArgs e)
            {
               
    try
                {
                   
    this.dtGrid.DataSource =null;
                    DataSet ds
    =new DataSet();
                    DateTime dtBegin
    = DateTime.Now;
                   
    byte[] datas = ws.GetZipCompress();
                    DateTime dtDown
    = DateTime.Now;
                   
    byte[] uzip = ComZipClass.zip.ZipDeCompress(datas);
                    DateTime dtUnzip
    = DateTime.Now;
                    ds
    = (DataSet)ComZipClass.zip.objXmlDeserialize(uzip, typeof(DataSet));
                    DateTime dtSerial
    = DateTime.Now;
                   
    this.dtGrid.DataSource = ds.Tables[0];
                    MessageBox.Show(
    string.Format("下载耗时:{0},解压ZIP耗时:{1},解压序列化耗时:{2},绑定数据耗时:{3},数据量:{4}",
                   dtDown
    - dtBegin, dtUnzip - dtDown, dtSerial - dtUnzip, DateTime.Now - dtSerial, datas.Length));
                }
               
    catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }

  • 相关阅读:
    Java 重载机制
    网关、DNS、子网掩码、MAC地址、路由器、猫
    前台?后台?前端?后端?
    JSP初学
    PS笔记
    Pandorabox等类OpenWrt的路由器 实现后端设备接入IPV6(中继代理+NAT)
    三星S5_G9008V 解锁联通4G(安卓6.0)
    一个意外的发现
    硬改路由器-MW310R-AR9341篇
    关于使用硬改的路由器的各种经历
  • 原文地址:https://www.cnblogs.com/mingyongcheng/p/3312303.html
Copyright © 2011-2022 走看看