Nanook.QueenBee.Parser.PakEditor.copyData C# (CSharp) Method

copyData() private method

Copy Data from one stream to the other with out using lots of memory
private copyData ( Stream sr, Stream sw, long length ) : void
sr Stream
sw Stream
length long
return void
        private void copyData(Stream sr, Stream sw, long length)
        {
            BinaryReader br = new BinaryReader(sr);
            BinaryWriter bw = new BinaryWriter(sw);
            long chunk = 1000000;
            while (length > 0)
            {
                if (length > chunk)
                {
                    bw.Write(br.ReadBytes((int)chunk));
                    length -= chunk;
                }
                else
                {
                    bw.Write(br.ReadBytes((int)length));
                    length = 0;
                }

            }
        }