Pchp.Library.Streams.PhpStream.ReadMaximumData C# (CSharp) Method

ReadMaximumData() public method

Most effecient access to the buffered stream consuming one whole buffer at a time. Performs no unnecessary conversions (although attached stream filters may do so).
Use the readChunkSize member to affect the amount of data returned at a time.
public ReadMaximumData ( ) : TextElement
return TextElement
        public TextElement ReadMaximumData()
        {
            // Set file access to reading
            CurrentAccess = FileAccess.Read;
            if (!CanRead) return TextElement.Null;

            TextElement data;

            //
            if ((readBuffers == null) || (readBuffers.Count == 0))
            {
                // Read one block without storing it in the buffers.
                data = ReadFiltered(readChunkSize);
                int filteredLength = data.Length;
                readFilteredCount += filteredLength;
            }
            else
            {
                // Dequeue one whole buffer.
                data = readBuffers.Peek();
                DropReadBuffer();
            }

            //
            return data;
        }