Class TallyKeepingFileStreamWriter
- Assembly
- Microsoft.Practices.EnterpriseLibrary.Logging.dll
Represents a file stream writer that keeps a tally of the length of the file.
public sealed class TallyKeepingFileStreamWriter : StreamWriter, IDisposable, IAsyncDisposable
- Inheritance
-
TallyKeepingFileStreamWriter
- Implements
- Inherited Members
Constructors
TallyKeepingFileStreamWriter(FileStream)
Initializes a new instance of the TallyKeepingFileStreamWriter class with the specified file stream.
public TallyKeepingFileStreamWriter(FileStream stream)
Parameters
stream
FileStreamThe FileStream to write to.
TallyKeepingFileStreamWriter(FileStream, Encoding)
Initializes a new instance of the TallyKeepingFileStreamWriter class with the specified file stream and encoding.
public TallyKeepingFileStreamWriter(FileStream stream, Encoding encoding)
Parameters
stream
FileStreamThe FileStream to write to.
encoding
EncodingThe Encoding to use.
Properties
Tally
Gets the tally of the length of the string.
public long Tally { get; }
Property Value
- long
The tally of the length of the string.
Methods
Write(char)
Writes a character to the stream.
public override void Write(char value)
Parameters
value
charThe character to write to the text stream.
Exceptions
- ObjectDisposedException
AutoFlush is true or the StreamWriter buffer is full, and current writer is closed.
- NotSupportedException
AutoFlush is true or the StreamWriter buffer is full, and the contents of the buffer cannot be written to the underlying fixed size stream because the StreamWriter is at the end the stream.
- IOException
An I/O error occurs.
Write(char[])
Writes a character array to the stream.
public override void Write(char[] buffer)
Parameters
buffer
char[]A character array containing the data to write. If buffer is null, nothing is written.
Exceptions
- ObjectDisposedException
AutoFlush is true or the StreamWriter buffer is full, and current writer is closed.
- NotSupportedException
AutoFlush is true or the StreamWriter buffer is full, and the contents of the buffer cannot be written to the underlying fixed size stream because the StreamWriter is at the end the stream.
- IOException
An I/O error occurs.
Write(char[], int, int)
Writes the specified buffer to the stream.
public override void Write(char[] buffer, int index, int count)
Parameters
buffer
char[]A character array containing the data to write.
index
intThe index into buffer at which to begin writing.
count
intThe number of characters to read from buffer.
Exceptions
- IOException
An I/O error occurs.
- ObjectDisposedException
AutoFlush is true or the StreamWriter buffer is full, and current writer is closed.
- NotSupportedException
AutoFlush is true or the StreamWriter buffer is full, and the contents of the buffer cannot be written to the underlying fixed size stream because the StreamWriter is at the end the stream.
- ArgumentOutOfRangeException
index or count is negative.
- ArgumentException
The buffer length minus index is less than count.
- ArgumentNullException
buffer is null.
Write(string)
Writes a string to the stream.
public override void Write(string value)
Parameters
value
stringThe string to write to the stream. If value is null, nothing is written.
Exceptions
- ObjectDisposedException
AutoFlush is true or the StreamWriter buffer is full, and current writer is closed.
- NotSupportedException
AutoFlush is true or the StreamWriter buffer is full, and the contents of the buffer cannot be written to the underlying fixed size stream because the StreamWriter is at the end the stream.
- IOException
An I/O error occurs.