Buffer.ReadNextStreamChunk C# (CSharp) Метод

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

private ReadNextStreamChunk ( ) : int
Результат int
    private int ReadNextStreamChunk()
    {
        int free = buf.Length - bufLen;
        if (free == 0) {
            // in the case of a growing input stream
            // we can neither seek in the stream, nor can we
            // foresee the maximum length, thus we must adapt
            // the buffer size on demand.
            byte[] newBuf = new byte[bufLen * 2];
            Array.Copy(buf, newBuf, bufLen);
            buf = newBuf;
            free = bufLen;
        }
        int read = stream.Read(buf, bufLen, free);
        if (read > 0) {
            fileLen = bufLen = (bufLen + read);
            return read;
        }
        // end of stream reached
        return 0;
    }