Encog.Util.DirectoryUtil.ReadStream C# (CSharp) Method

ReadStream() public static method

Read the entire contents of a stream into a string.
public static ReadStream ( Stream istream ) : String
istream Stream The input stream to read from.
return String
        public static String ReadStream(Stream istream)
        {
            try
            {
                var sb = new StringBuilder(1024);

                var chars = new byte[BufferSize];
                while ((istream.Read(chars, 0, chars.Length)) > -1)
                {
                    string s = Encoding.ASCII.GetString(chars);
                    sb.Append(s);
                }

                return sb.ToString();
            }
            catch (IOException e)
            {
#if logging
                LOGGER.Error("Exception", e);
#endif
                throw new EncogError(e);
            }
        }
#endif