SwfDotNet.IO.Utils.BufferedBinaryReader.ReadInternal C# (CSharp) Méthode

ReadInternal() private méthode

Reads the given number of bytes from the stream, throwing an exception if they can't all be read.
private ReadInternal ( byte data, int size ) : void
data byte Buffer to read into
size int Number of bytes to read
Résultat void
        private void ReadInternal(byte[] data, int size)
        {
            int index = 0;
            while (index < size)
            {
                int read = this.BaseStream.Read(data, index, size-index);
                if (read == 0)
                {
                    throw new EndOfStreamException
                        (String.Format("End of stream reached with {0} byte{1} left to read.", size-index,
                        size-index==1 ? "s" : ""));
                }
                index += read;
            }
        }