• 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());
                }
            }

  • 相关阅读:
    Codeforces Round #594 (Div. 2) ABC题
    Codeforces Round #596 (Div. 2) ABCD题
    数据结构实验5——二叉树
    数据结构实验4——字符串匹配
    数据结构实验3——用栈求解算术表达式
    友链
    Codeforces Round #577 (Div. 2)
    Educational Codeforces Round 70 (Rated for Div. 2)
    Codeforces Round #578 (Div. 2)
    2020 Multi-University Training Contest 10(待补
  • 原文地址:https://www.cnblogs.com/mingyongcheng/p/3312303.html
Copyright © 2020-2023  润新知