Ejemplo n.º 1
0
        public override void WriteBytes(byte[] b, int offset, int len)
        {
            CheckCrashed();
            CheckDiskFull(b, offset, null, len);

            if (dir.randomState.Next(200) == 0)
            {
                int half = len / 2;
                @delegate.WriteBytes(b, offset, half);
                Thread.Sleep(0);
                @delegate.WriteBytes(b, offset + half, len - half);
            }
            else
            {
                @delegate.WriteBytes(b, offset, len);
            }

            dir.MaybeThrowDeterministicException();

            if (first)
            {
                // Maybe throw random exception; only do this on first
                // write to a new file:
                first = false;
                dir.MaybeThrowIOException(name);
            }
        }