示例#1
0
 public int GetInt(int pos)
 {
     GetStream().Seek(pos, SeekOrigin.Begin);
     byte[] bytes = new byte[sizeof(int)];
     GetStream().Read(bytes, 0, sizeof(int));
     return(BitConverterExt.BytesToInt32(bytes));
 }
示例#2
0
 private void removeChecksum()
 {
     this.BaseStream.Seek(4, SeekOrigin.End);
     byte[] buffer = new byte[4];
     this.BaseStream.Read(buffer, 0, 4);
     this.checksum = (uint)BitConverterExt.GetIntWithNetworkOrder(buffer);
     this.BaseStream.Seek(0, SeekOrigin.Begin);
 }
示例#3
0
 public override void Close()
 {
     base.Close();
     if (this.mode.Equals(CompressionMode.Compress))
     {
         this.stream.Write(BitConverterExt.GetBytesWithNetworkOrder((int)checksum), 0, sizeof(uint));
     }
     if (!this.leaveOpen)
     {
         this.stream.Close();
     }
 }
示例#4
0
 public void Write(int v, int pos)
 {
     GetStream().Seek(pos, SeekOrigin.Begin);
     byte[] bytes = BitConverterExt.Int32ToBytes(v);
     GetStream().Write(bytes, 0, bytes.Length);
 }