NVelocity.Runtime.Resource.ContentResource.Process C# (CSharp) Method

Process() public method

Pull in static content and store it. @exception ResourceNotFoundException Resource could not be found.
public Process ( ) : bool
return bool
        public override bool Process()
        {
            StreamReader reader = null;

            try
            {
                StringWriter sw = new StringWriter();

                reader = new StreamReader(
                    new StreamReader(
                        resourceLoader.GetResourceStream(name),
                        System.Text.Encoding.GetEncoding(encoding)).BaseStream);

                char[] buf = new char[1024];
                int len = 0;

                // -1 in java, 0 in .Net
                while((len = reader.Read(buf, 0, 1024)) > 0)
                {
                    sw.Write(buf, 0, len);
                }

                data = sw.ToString();

                return true;
            }
            catch(ResourceNotFoundException e)
            {
                // Tell the ContentManager to continue to look through any
                // remaining configured ResourceLoaders.
                throw e;
            }
            catch(Exception e)
            {
                runtimeServices.Error(string.Format("Cannot process content resource : {0}", e.ToString()));
                return false;
            }
            finally
            {
                if (reader != null)
                {
                    try
                    {
                        reader.Close();
                    }
                    catch(Exception)
                    {
                    }
                }
            }
        }