Ejemplo n.º 1
0
            ///////////////////////////////////////////////////////////////////

            public override int Read(
                byte[] buffer,
                int offset,
                int count
                )
            {
                CheckDisposed();

                if (!canRead)
                {
                    throw new NotSupportedException();
                }

                if (buffer == null)
                {
                    throw new ArgumentNullException();
                }

                if ((offset < 0) || (count < 0))
                {
                    throw new ArgumentOutOfRangeException();
                }

                int length = buffer.Length;

                if ((offset + count) > length)
                {
                    throw new ArgumentException();
                }

                //
                // NOTE: Log the read request because it should be somewhat
                //       unusual.
                //
                DebugOps.TraceWriteLineFormatted(String.Format(
                                                     "Read: request for {0} bytes starting at offset {1}",
                                                     count, offset), typeof(DiagnosticStream).Name);

                return(0);
            }