示例#1
0
 /// <summary>
 /// Appends to the body stream
 /// </summary>
 /// <returns>The total amount of bytes added</returns>
 public int AppendBody(byte[] value, int offset, int count)
 {
     if (Header == null)
     {
         throw new DriverInternalError("To add a response body you must specify the header");
     }
     if (BodyStream == null)
     {
         if (Header.BodyLength <= count)
         {
             //There is no need to copy the buffer: Use the inner buffer
             BodyStream = new MemoryStream(value, offset, this.Header.BodyLength, false, false);
             return(this.Header.BodyLength);
         }
         BodyStream = new ListBackedStream();
     }
     if (BodyStream.Position + count > Header.BodyLength)
     {
         count = Header.BodyLength - (int)BodyStream.Position;
     }
     BodyStream.Write(value, offset, count);
     return(count);
 }
示例#2
0
 /// <summary>
 /// Appends to the body stream
 /// </summary>
 /// <returns>The total amount of bytes added</returns>
 public int AppendBody(byte[] value, int offset, int count)
 {
     if (Header == null)
     {
         throw new DriverInternalError("To add a response body you must specify the header");
     }
     if (BodyStream == null)
     {
         if (Header.BodyLength <= count)
         {
             //There is no need to copy the buffer: Use the inner buffer
             BodyStream = new MemoryStream(value, offset, this.Header.BodyLength, false, false);
             return this.Header.BodyLength;
         }
         BodyStream = new ListBackedStream();
     }
     if (BodyStream.Position + count > Header.BodyLength)
     {
         count = Header.BodyLength - (int) BodyStream.Position;
     }
     BodyStream.Write(value, offset, count);
     return count;
 }
示例#3
0
 public BEBinaryWriter()
 {
     _stream = new ListBackedStream();
     _stream.KeepReferences = true;
 }
 public BEBinaryWriter()
 {
     _stream = new ListBackedStream();
     _stream.KeepReferences = true;
 }