public static GetBytes ( byte buffer, int &index, int count ) : byte[] | ||
buffer | byte | the buffer stores the value. |
index | int | the index of start to parse |
count | int | count of bytes |
return | byte[] |
/// <summary> /// Get the request body byte array from the specified http request. /// </summary> /// <param name="httpListenerRequest">The specified http request.</param> /// <exception cref="ObjectDisposedException"> /// Throw when an operation is performed on a disposed object. /// </exception> private void DecomposeHttpRequest(HttpListenerRequest httpListenerRequest) { if (httpListenerRequest == null) { throw new ArgumentNullException("httpListenerRequest"); } this.httpRequestUri = httpListenerRequest.Url; this.httpRequestMethod = httpListenerRequest.HttpMethod; try { Stream requestStream = httpListenerRequest.InputStream; byte[] payloadBuffer = new byte[this.bufferSize]; int readSize = 0; while (true) { int tempIndex = 0; readSize = requestStream.Read(payloadBuffer, 0, payloadBuffer.Length); if (readSize == 0) { break; } else { this.httpRequestPayload = DecodeMessage.GetBytes(payloadBuffer, ref tempIndex, readSize); } } requestStream.Close(); } catch (ObjectDisposedException e) { if (this.logger != null) { this.logger.AddWarning( string.Format("Object disposed exception is catched, detailed information: {0}.", e.Message)); } else { throw; } } if (this.logger != null) { this.logger.AddDebug("Unmarshal PCHC request message is successfully."); } }