ReadFully() публичный Метод

public ReadFully ( byte b ) : void
b byte
Результат void
        public void TestReadFully()
        {
            const string READFULLY_TEST_FILE = "Lucene.Net.Tests.core.Support.ReadFully.txt";
            byte[] buffer = new byte[1367];

            Stream @in = GetType().Assembly.GetManifestResourceStream(READFULLY_TEST_FILE);
            DataInputStream dis;
            using (dis = new DataInputStream(@in))
            {
                // Read once for real
                dis.ReadFully(buffer, 0, 1366);
            }

            // Read past the end of the stream
            @in = GetType().Assembly.GetManifestResourceStream(READFULLY_TEST_FILE);
            dis = new DataInputStream(@in);
            bool caughtException = false;
            try
            {
                dis.ReadFully(buffer, 0, buffer.Length);
            }
            #pragma warning disable 168
            catch (EndOfStreamException ie)
            #pragma warning restore 168
            {
                caughtException = true;
            }
            finally
            {
                dis.Dispose();
                if (!caughtException)
                    fail("Test failed");
            }

            // Ensure we get an IndexOutOfRangeException exception when length is negative
            @in = GetType().Assembly.GetManifestResourceStream(READFULLY_TEST_FILE);
            dis = new DataInputStream(@in);
            caughtException = false;
            try
            {
                dis.ReadFully(buffer, 0, -20);
            }
            #pragma warning disable 168
            catch (IndexOutOfRangeException ie)
            #pragma warning restore 168
            {
                caughtException = true;
            }
            finally
            {
                dis.Dispose();
                if (!caughtException)
                    fail("Test failed");
            }
        }
        public void TestReadFully()
        {
            const string READFULLY_TEST_FILE = "Lucene.Net.Tests.core.Support.ReadFully.txt";

            byte[] buffer = new byte[1367];

            Stream          @in = GetType().Assembly.GetManifestResourceStream(READFULLY_TEST_FILE);
            DataInputStream dis;

            using (dis = new DataInputStream(@in))
            {
                // Read once for real
                dis.ReadFully(buffer, 0, 1366);
            }

            // Read past the end of the stream
            @in = GetType().Assembly.GetManifestResourceStream(READFULLY_TEST_FILE);
            dis = new DataInputStream(@in);
            bool caughtException = false;

            try
            {
                dis.ReadFully(buffer, 0, buffer.Length);
            }
#pragma warning disable 168
            catch (EndOfStreamException ie)
#pragma warning restore 168
            {
                caughtException = true;
            }
            finally
            {
                dis.Dispose();
                if (!caughtException)
                {
                    fail("Test failed");
                }
            }

            // Ensure we get an IndexOutOfRangeException exception when length is negative
            @in             = GetType().Assembly.GetManifestResourceStream(READFULLY_TEST_FILE);
            dis             = new DataInputStream(@in);
            caughtException = false;
            try
            {
                dis.ReadFully(buffer, 0, -20);
            }
#pragma warning disable 168
            catch (IndexOutOfRangeException ie)
#pragma warning restore 168
            {
                caughtException = true;
            }
            finally
            {
                dis.Dispose();
                if (!caughtException)
                {
                    fail("Test failed");
                }
            }
        }