From 2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Mon, 16 Jul 2007 15:40:11 +0000 Subject: changed to native line ending encoding --- OpenSim/Framework/Servers/BinaryStreamHandler.cs | 98 ++++++++++++------------ 1 file changed, 49 insertions(+), 49 deletions(-) (limited to 'OpenSim/Framework/Servers/BinaryStreamHandler.cs') diff --git a/OpenSim/Framework/Servers/BinaryStreamHandler.cs b/OpenSim/Framework/Servers/BinaryStreamHandler.cs index 7d4e4ce..6e512f6 100644 --- a/OpenSim/Framework/Servers/BinaryStreamHandler.cs +++ b/OpenSim/Framework/Servers/BinaryStreamHandler.cs @@ -1,49 +1,49 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; - -namespace OpenSim.Framework.Servers -{ - public delegate string BinaryMethod(byte[] data, string path, string param); - - public class BinaryStreamHandler : BaseStreamHandler - { - BinaryMethod m_method; - - override public byte[] Handle(string path, Stream request) - { - byte[] data = ReadFully(request); - string param = GetParam(path); - string responseString = m_method(data, path, param); - - return Encoding.UTF8.GetBytes(responseString); - } - - public BinaryStreamHandler(string httpMethod, string path, BinaryMethod binaryMethod) - : base(httpMethod, path) - { - m_method = binaryMethod; - } - - private byte[] ReadFully(Stream stream) - { - byte[] buffer = new byte[32768]; - using (MemoryStream ms = new MemoryStream()) - { - while (true) - { - int read = stream.Read(buffer, 0, buffer.Length); - - if (read <= 0) - { - return ms.ToArray(); - } - - ms.Write(buffer, 0, read); - } - } - } - } - -} +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; + +namespace OpenSim.Framework.Servers +{ + public delegate string BinaryMethod(byte[] data, string path, string param); + + public class BinaryStreamHandler : BaseStreamHandler + { + BinaryMethod m_method; + + override public byte[] Handle(string path, Stream request) + { + byte[] data = ReadFully(request); + string param = GetParam(path); + string responseString = m_method(data, path, param); + + return Encoding.UTF8.GetBytes(responseString); + } + + public BinaryStreamHandler(string httpMethod, string path, BinaryMethod binaryMethod) + : base(httpMethod, path) + { + m_method = binaryMethod; + } + + private byte[] ReadFully(Stream stream) + { + byte[] buffer = new byte[32768]; + using (MemoryStream ms = new MemoryStream()) + { + while (true) + { + int read = stream.Read(buffer, 0, buffer.Length); + + if (read <= 0) + { + return ms.ToArray(); + } + + ms.Write(buffer, 0, read); + } + } + } + } + +} -- cgit v1.1