zoukankan      html  css  js  c++  java
  • 读取二进制字段内容代码

     BinaryWriter bw;
                int bufferSize = 1024;
                byte[] outbyte = new byte[bufferSize];
                long retval;
                long startIndex = 0;
                MemoryStream ms = new MemoryStream();
                           
                bw = new BinaryWriter(ms);
                startIndex = 0;
                retval = reader.GetBytes(reader.GetOrdinal("MapContent"), startIndex, outbyte, 0, bufferSize);
                while (retval == bufferSize)
                {
                    bw.Write(outbyte);
                    bw.Flush();
                    startIndex += bufferSize;

                    if (startIndex < model.MapSize)
                        retval = reader.GetBytes(reader.GetOrdinal("MapContent"), startIndex, outbyte, 0, bufferSize);
                    else
                        break;
                }

                bw.Write(outbyte);
                bw.Flush();
                model.MapContent = ms.ToArray();

  • 相关阅读:
    暑假每周学习进度-7
    暑假每周学习进度-6
    寒假生活05
    寒假生活04
    寒假生活03
    寒假生活02
    寒假生活01
    软件设计师2019模拟小测
    第二周学习记录
    2019秋季学习计划
  • 原文地址:https://www.cnblogs.com/xiaoko/p/1342011.html
Copyright © 2011-2022 走看看