nicko       2005/08/31 01:14:10

  Modified:    src/Util CountingQuietTextWriter.cs
  Log:
  Fix for LOG4NET-49, Added missing overrides to CountingQuietTextWriter
  
  Revision  Changes    Path
  1.6       +60 -1     logging-log4net/src/Util/CountingQuietTextWriter.cs
  
  Index: CountingQuietTextWriter.cs
  ===================================================================
  RCS file: /home/cvs/logging-log4net/src/Util/CountingQuietTextWriter.cs,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CountingQuietTextWriter.cs        31 Jan 2005 22:56:49 -0000      1.5
  +++ CountingQuietTextWriter.cs        31 Aug 2005 08:14:10 -0000      1.6
  @@ -59,12 +59,71 @@
                #region Override implementation of QuietTextWriter

     

                /// <summary>

  +             /// Writes a character to the underlying writer and counts the 
number of bytes written.

  +             /// </summary>

  +             /// <param name="value">the char to write</param>

  +             /// <remarks>

  +             /// <para>

  +             /// Overrides implementation of <see cref="QuietTextWriter"/>. 
Counts

  +             /// the number of bytes written.

  +             /// </para>

  +             /// </remarks>

  +             public override void Write(char value) 

  +             {

  +                     try 

  +                     {

  +                             base.Write(value);

  +

  +                             // get the number of bytes needed to represent 
the 

  +                             // char using the supplied encoding.

  +                             m_countBytes += this.Encoding.GetByteCount(new 
char[] { value });

  +                     } 

  +                     catch(Exception e) 

  +                     {

  +                             this.ErrorHandler.Error("Failed to write [" + 
value + "].", e, ErrorCode.WriteFailure);

  +                     }

  +             }

  +    

  +             /// <summary>

  +             /// Writes a buffer to the underlying writer and counts the 
number of bytes written.

  +             /// </summary>

  +             /// <param name="buffer">the buffer to write</param>

  +             /// <param name="index">the start index to write from</param>

  +             /// <param name="count">the number of characters to 
write</param>

  +             /// <remarks>

  +             /// <para>

  +             /// Overrides implementation of <see cref="QuietTextWriter"/>. 
Counts

  +             /// the number of bytes written.

  +             /// </para>

  +             /// </remarks>

  +             public override void Write(char[] buffer, int index, int count) 

  +             {

  +                     if (count > 0)

  +                     {

  +                             try 

  +                             {

  +                                     base.Write(buffer, index, count);

  +

  +                                     // get the number of bytes needed to 
represent the 

  +                                     // char array using the supplied 
encoding.

  +                                     m_countBytes += 
this.Encoding.GetByteCount(buffer, index, count);

  +                             } 

  +                             catch(Exception e) 

  +                             {

  +                                     this.ErrorHandler.Error("Failed to 
write buffer.", e, ErrorCode.WriteFailure);

  +                             }

  +                     }

  +             }

  +

  +             /// <summary>

                /// Writes a string to the output and counts the number of 
bytes written.

                /// </summary>

                /// <param name="str">The string data to write to the 
output.</param>

                /// <remarks>

  +             /// <para>

                /// Overrides implementation of <see cref="QuietTextWriter"/>. 
Counts

                /// the number of bytes written.

  +             /// </para>

                /// </remarks>

                override public void Write(string str) 

                {

  @@ -84,7 +143,7 @@
                                }

                        }

                }

  -

  +             

                #endregion Override implementation of QuietTextWriter

   

                #region Public Instance Properties

  
  
  

Reply via email to