Code/Framework/AzCore/AzCore/IO/GenericStreams.cpp
SizeType GenericStream::WriteFromStream(SizeType bytes, GenericStream* inputStream)
        {
            char tempBuffer[StreamToStreamCopyBufferSize];
            SizeType totalBytesWritten = 0;

            AZ_Assert(inputStream, "Cannot copy from a null input stream.");
            AZ_Assert(inputStream != this, "Can't write and read from the same stream.");

            // Loop through the total number of bytes requested, reading a chunk of it at a time from the inputStream
            // into tempBuffer, then writing it out into this stream.
            for (SizeType windowOffset = 0; windowOffset < bytes; windowOffset += StreamToStreamCopyBufferSize)
            {
                // Read in the appropriate number of bytes on every loop iteration.
                // (ex:  515 bytes requested will read 256 bytes, 256 bytes, and 3 bytes)
                SizeType transferBytes = AZ::GetMin(bytes - windowOffset, aznumeric_cast<SizeType>(StreamToStreamCopyBufferSize));

                SizeType bytesRead = inputStream->Read(transferBytes, tempBuffer);
                if (bytesRead > 0)
                {
                    totalBytesWritten += Write(bytesRead, tempBuffer);
                }
            }

            return totalBytesWritten;
        }
/*!
        \brief Default implementation of WriteFromStream, this will transfer bytes from any generic input stream to this stream.
        Any stream that writes into a preexisting memory buffer can implement a more efficient version of this method that
        directly passes the memory buffer into the inputStream to save one memory copy of the data.
        \param bytes Amount of bytes to write
        \param inputStream The stream to read data from
        */
\brief Default implementation of WriteFromStream, this will transfer bytes from any generic input stream to this stream.
Any stream that writes into a preexisting memory buffer can implement a more efficient version of this method that
directly passes the memory buffer into the inputStream to save one memory copy of the data.
\param bytes Amount of bytes to write
\param inputStream The stream to read data from
\ brief Default implementation of WriteFromStream this will transfer bytes from any generic input stream to this stream . Any stream that writes into a preexisting memory buffer can implement a more efficient version of this method that directly passes the memory buffer into the inputStream to save one memory copy of the data . \ param bytes Amount of bytes to write \ param inputStream The stream to read data from
SizeType GenericStream::WriteFromStream(SizeType bytes, GenericStream* inputStream)
        {
            char tempBuffer[StreamToStreamCopyBufferSize];
            SizeType totalBytesWritten = 0;
            AZ_Assert(inputStream, "Cannot copy from a null input stream.");
            AZ_Assert(inputStream != this, "Can't write and read from the same stream.");
            for (SizeType windowOffset = 0; windowOffset < bytes; windowOffset += StreamToStreamCopyBufferSize)
            {
                SizeType transferBytes = AZ::GetMin(bytes - windowOffset, aznumeric_cast<SizeType>(StreamToStreamCopyBufferSize));
                SizeType bytesRead = inputStream->Read(transferBytes, tempBuffer);
                if (bytesRead > 0)
                {
                    totalBytesWritten += Write(bytesRead, tempBuffer);
                }
            }
            return totalBytesWritten;
        }
SizeType GenericStream :: WriteFromStream ( SizeType bytes , GenericStream * inputStream ) { char tempBuffer [ StreamToStreamCopyBufferSize ] ; SizeType totalBytesWritten = 0 ; AZ_Assert ( inputStream , " " ) ; AZ_Assert ( inputStream != this , " " ) ; for ( SizeType windowOffset = 0 ; windowOffset < bytes ; windowOffset += StreamToStreamCopyBufferSize ) { SizeType transferBytes = AZ :: GetMin ( bytes - windowOffset , aznumeric_cast < SizeType > ( StreamToStreamCopyBufferSize ) ) ; SizeType bytesRead = inputStream -> Read ( transferBytes , tempBuffer ) ; if ( bytesRead > 0 ) { totalBytesWritten += Write ( bytesRead , tempBuffer ) ; } } return totalBytesWritten ; }
\brief Default implementation of WriteFromStream, this will transfer bytes from any generic input stream to this stream.
\ brief Default implementation of WriteFromStream this will transfer bytes from any generic input stream to this stream .
// Loop through the total number of bytes requested, reading a chunk of it at a time from the inputStream // into tempBuffer, then writing it out into this stream. // Read in the appropriate number of bytes on every loop iteration. // (ex:  515 bytes requested will read 256 bytes, 256 bytes, and 3 bytes)