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;
}
}