An input stream which canonicalizes EOLs bytes on the fly to '\n'.
An input stream which canonicalizes EOLs bytes on the fly to '\n'. Optionally, a binary check on the first 8000 bytes is performed and in case of binary files, canonicalization is turned off (for the complete file).
Inheritance: Sharpen.InputStream
        /// <exception cref="System.IO.IOException"></exception>
        private void Test(byte[] input, byte[] expected, bool detectBinary)
        {
            InputStream bis1   = new ByteArrayInputStream(input);
            InputStream cis1   = new EolCanonicalizingInputStream(bis1, detectBinary);
            int         index1 = 0;

            for (int b = cis1.Read(); b != -1; b = cis1.Read())
            {
                NUnit.Framework.Assert.AreEqual(expected[index1], unchecked ((byte)b));
                index1++;
            }
            NUnit.Framework.Assert.AreEqual(expected.Length, index1);
            for (int bufferSize = 1; bufferSize < 10; bufferSize++)
            {
                byte[]      buffer = new byte[bufferSize];
                InputStream bis2   = new ByteArrayInputStream(input);
                InputStream cis2   = new EolCanonicalizingInputStream(bis2, detectBinary);
                int         read   = 0;
                for (int readNow = cis2.Read(buffer, 0, buffer.Length); readNow != -1 && read < expected
                     .Length; readNow = cis2.Read(buffer, 0, buffer.Length))
                {
                    for (int index2 = 0; index2 < readNow; index2++)
                    {
                        NUnit.Framework.Assert.AreEqual(expected[read + index2], buffer[index2]);
                    }
                    read += readNow;
                }
                NUnit.Framework.Assert.AreEqual(expected.Length, read);
                cis2.Close();
            }
            cis1.Close();
        }
 /// <exception cref="System.IO.IOException"></exception>
 private void Test(byte[] input, byte[] expected)
 {
     InputStream bis1 = new ByteArrayInputStream(input);
     InputStream cis1 = new EolCanonicalizingInputStream(bis1);
     int index1 = 0;
     for (int b = cis1.Read(); b != -1; b = cis1.Read())
     {
         NUnit.Framework.Assert.AreEqual(expected[index1], unchecked((byte)b));
         index1++;
     }
     NUnit.Framework.Assert.AreEqual(expected.Length, index1);
     for (int bufferSize = 1; bufferSize < 10; bufferSize++)
     {
         byte[] buffer = new byte[bufferSize];
         InputStream bis2 = new ByteArrayInputStream(input);
         InputStream cis2 = new EolCanonicalizingInputStream(bis2);
         int read = 0;
         for (int readNow = cis2.Read(buffer, 0, buffer.Length); readNow != -1 && read < expected
             .Length; readNow = cis2.Read(buffer, 0, buffer.Length))
         {
             for (int index2 = 0; index2 < readNow; index2++)
             {
                 NUnit.Framework.Assert.AreEqual(expected[read + index2], buffer[index2]);
             }
             read += readNow;
         }
         NUnit.Framework.Assert.AreEqual(expected.Length, read);
     }
 }