/// <summary>Creates a <code>InputDataStream</code>.</summary> /// <param name="buf">The first buffer in the data stream.</param> internal InputDataStream(BufferSegment buf, bool complete) : this(buf) { if (complete) { this.setComplete(); } }
/// <summary>Creates a <code>InputDataStream</code>.</summary> /// <param name="buf">The first buffer in the data stream.</param> internal InputDataStream(BufferSegment buf) { this.add(buf); }
internal virtual void add(BufferSegment segment) { if (this.closed) { if (this.channel != null) { this.channel.freeReceiveBufferBytes(segment.Length); } return ; } lock (this.buffers) { this.buffers.Add(segment); System.Threading.Monitor.Pulse(this.buffers); } this.availableBytes += segment.Length; }
/// <summary>Returns an array of <code>BufferSegment</code> objects.</summary> public virtual BufferSegment[] getBytes() { BufferSegment[] b = new BufferSegment[this.payload.Count + 2]; this.size = 0; int j = 1; foreach(BufferSegment bs in this.payload) { b[j] = bs; this.size += b[j].Length; ++j; } b[0] = new BufferSegment(buildHeader()); b[j] = trailerBufferSegment; return b; }
/// <summary>Adds the <code>BufferSegment</code> to the list representing the /// payload for this frame.</summary> public virtual void addPayload(BufferSegment buf) { this.payload.Add(buf); }
/// <summary>If there are no bytes remaining in the current buffer move to /// the next one if it exists.</summary> private bool setNextBuffer() { while (pos == curBuf.Length) { if (ids.availableSegment() == false) { return false; } curBuf = ids.NextSegment; pos = 0; } return true; }
private void InitBlock() { curBuf = zeroLength; log = LogFactory.getLog(this.GetType()); state = STATE_INIT; name = new System.IO.MemoryStream(32); value_Renamed = new System.IO.MemoryStream(32); mimeHeaders = new System.Collections.Hashtable(DEFAULT_HEADER_TABLE_SIZE); }