NVelocity.Runtime.Parser.VelocityCharStream.FillBuff C# (CSharp) Метод

FillBuff() приватный Метод

private FillBuff ( ) : bool
Результат bool
        private bool FillBuff()
        {
            if (maxNextCharInd == available)
            {
                if (available == bufferSize)
                {
                    if (tokenBegin > 2048)
                    {
                        bufferPosition = maxNextCharInd = 0;
                        available = tokenBegin;
                    }
                    else if (tokenBegin < 0)
                    {
                        bufferPosition = maxNextCharInd = 0;
                    }
                    else
                    {
                        ExpandBuff(false);
                    }
                }
                else if (available > tokenBegin)
                {
                    available = bufferSize;
                }
                else if ((tokenBegin - available) < 2048)
                {
                    ExpandBuff(true);
                }
                else
                {
                    available = tokenBegin;
                }
            }

            try
            {
                int canRead = inputStream.Read(buffer, maxNextCharInd, available - maxNextCharInd);

                if (canRead <= 0)
                {
                    inputStream.Close();
                    return EndRead();
                }
                else
                {
                    maxNextCharInd += canRead;
                    return true;
                }
            }
            catch(Exception)
            {
                return EndRead();
            }
        }