Class SafeTextWriterWrapper
Decorates a System.IO.TextWriter instance and
makes no assumptions about whether System.IDisposable.Dispose()
has been called on the inner instance or not. Acts like a circuit breaker -
the first System.ObjectDisposedException caught turns it off and
the rest of the calls are ignored after that point until Reset()
is called.
The primary purpose is for using a System.IO.TextWriter instance within a non-disposable
parent object. Since the creator of the System.IO.TextWriter ultimately is responsible for
disposing it, our non-disposable object has no way of knowing whether it is safe to use the System.IO.TextWriter.
Wraping the System.IO.TextWriter within a SafeTextWriterWrapper ensures the
non-disposable object can continue to make calls to the System.IO.TextWriter without raising
exceptions (it is presumed that the System.IO.TextWriter functionality is optional).
Inheritance
System.Object
System.IO.TextWriter
SafeTextWriterWrapper
Implements
System.IDisposable
Inherited Members
System.IO.TextWriter.CoreNewLine
System.IO.TextWriter.Null
System.IO.TextWriter.Dispose()
System.IO.TextWriter.WriteAsync(System.Char[])
System.IO.TextWriter.WriteLineAsync(System.Char[])
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: Lucene.Net.dll
Syntax
public class SafeTextWriterWrapper : TextWriter, IDisposable
Constructors
|
Improve this Doc
View Source
SafeTextWriterWrapper(TextWriter)
Declaration
public SafeTextWriterWrapper(TextWriter textWriter)
Parameters
Type |
Name |
Description |
System.IO.TextWriter |
textWriter |
|
Properties
|
Improve this Doc
View Source
Encoding
Declaration
public override Encoding Encoding { get; }
Property Value
Type |
Description |
System.Text.Encoding |
|
Overrides
System.IO.TextWriter.Encoding
|
Improve this Doc
View Source
FormatProvider
Declaration
public override IFormatProvider FormatProvider { get; }
Property Value
Type |
Description |
System.IFormatProvider |
|
Overrides
System.IO.TextWriter.FormatProvider
|
Improve this Doc
View Source
NewLine
Declaration
public override string NewLine { get; set; }
Property Value
Type |
Description |
System.String |
|
Overrides
System.IO.TextWriter.NewLine
Methods
|
Improve this Doc
View Source
Dispose(Boolean)
Declaration
protected override void Dispose(bool disposing)
Parameters
Type |
Name |
Description |
System.Boolean |
disposing |
|
Overrides
System.IO.TextWriter.Dispose(System.Boolean)
|
Improve this Doc
View Source
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
System.Object |
obj |
|
Returns
Type |
Description |
System.Boolean |
|
Overrides
System.Object.Equals(System.Object)
|
Improve this Doc
View Source
Flush()
Declaration
public override void Flush()
Overrides
System.IO.TextWriter.Flush()
|
Improve this Doc
View Source
FlushAsync()
Declaration
public override Task FlushAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Overrides
System.IO.TextWriter.FlushAsync()
|
Improve this Doc
View Source
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
Overrides
System.Object.GetHashCode()
|
Improve this Doc
View Source
Reset()
Declaration
public virtual void Reset()
|
Improve this Doc
View Source
ToString()
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
|
Overrides
System.Object.ToString()
|
Improve this Doc
View Source
Write(Boolean)
Declaration
public override void Write(bool value)
Parameters
Type |
Name |
Description |
System.Boolean |
value |
|
Overrides
System.IO.TextWriter.Write(System.Boolean)
|
Improve this Doc
View Source
Write(Char)
Declaration
public override void Write(char value)
Parameters
Type |
Name |
Description |
System.Char |
value |
|
Overrides
System.IO.TextWriter.Write(System.Char)
|
Improve this Doc
View Source
Write(Char[])
Declaration
public override void Write(char[] buffer)
Parameters
Type |
Name |
Description |
System.Char[] |
buffer |
|
Overrides
System.IO.TextWriter.Write(System.Char[])
|
Improve this Doc
View Source
Write(Char[], Int32, Int32)
Declaration
public override void Write(char[] buffer, int index, int count)
Parameters
Type |
Name |
Description |
System.Char[] |
buffer |
|
System.Int32 |
index |
|
System.Int32 |
count |
|
Overrides
System.IO.TextWriter.Write(System.Char[], System.Int32, System.Int32)
|
Improve this Doc
View Source
Write(Decimal)
Declaration
public override void Write(decimal value)
Parameters
Type |
Name |
Description |
System.Decimal |
value |
|
Overrides
System.IO.TextWriter.Write(System.Decimal)
|
Improve this Doc
View Source
Write(Double)
Declaration
public override void Write(double value)
Parameters
Type |
Name |
Description |
System.Double |
value |
|
Overrides
System.IO.TextWriter.Write(System.Double)
|
Improve this Doc
View Source
Write(Int32)
Declaration
public override void Write(int value)
Parameters
Type |
Name |
Description |
System.Int32 |
value |
|
Overrides
System.IO.TextWriter.Write(System.Int32)
|
Improve this Doc
View Source
Write(Int64)
Declaration
public override void Write(long value)
Parameters
Type |
Name |
Description |
System.Int64 |
value |
|
Overrides
System.IO.TextWriter.Write(System.Int64)
|
Improve this Doc
View Source
Write(Object)
Declaration
public override void Write(object value)
Parameters
Type |
Name |
Description |
System.Object |
value |
|
Overrides
System.IO.TextWriter.Write(System.Object)
|
Improve this Doc
View Source
Write(Single)
Declaration
public override void Write(float value)
Parameters
Type |
Name |
Description |
System.Single |
value |
|
Overrides
System.IO.TextWriter.Write(System.Single)
|
Improve this Doc
View Source
Write(String)
Declaration
public override void Write(string value)
Parameters
Type |
Name |
Description |
System.String |
value |
|
Overrides
System.IO.TextWriter.Write(System.String)
|
Improve this Doc
View Source
Write(String, Object)
Declaration
public override void Write(string format, object arg0)
Parameters
Type |
Name |
Description |
System.String |
format |
|
System.Object |
arg0 |
|
Overrides
System.IO.TextWriter.Write(System.String, System.Object)
|
Improve this Doc
View Source
Write(String, Object, Object)
Declaration
public override void Write(string format, object arg0, object arg1)
Parameters
Type |
Name |
Description |
System.String |
format |
|
System.Object |
arg0 |
|
System.Object |
arg1 |
|
Overrides
System.IO.TextWriter.Write(System.String, System.Object, System.Object)
|
Improve this Doc
View Source
Write(String, Object, Object, Object)
Declaration
public override void Write(string format, object arg0, object arg1, object arg2)
Parameters
Type |
Name |
Description |
System.String |
format |
|
System.Object |
arg0 |
|
System.Object |
arg1 |
|
System.Object |
arg2 |
|
Overrides
System.IO.TextWriter.Write(System.String, System.Object, System.Object, System.Object)
|
Improve this Doc
View Source
Write(String, Object[])
Declaration
public override void Write(string format, params object[] arg)
Parameters
Type |
Name |
Description |
System.String |
format |
|
System.Object[] |
arg |
|
Overrides
System.IO.TextWriter.Write(System.String, System.Object[])
|
Improve this Doc
View Source
Write(UInt32)
Declaration
[CLSCompliant(false)]
public override void Write(uint value)
Parameters
Type |
Name |
Description |
System.UInt32 |
value |
|
Overrides
System.IO.TextWriter.Write(System.UInt32)
|
Improve this Doc
View Source
Write(UInt64)
Declaration
[CLSCompliant(false)]
public override void Write(ulong value)
Parameters
Type |
Name |
Description |
System.UInt64 |
value |
|
Overrides
System.IO.TextWriter.Write(System.UInt64)
|
Improve this Doc
View Source
WriteAsync(Char)
Declaration
public override Task WriteAsync(char value)
Parameters
Type |
Name |
Description |
System.Char |
value |
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Overrides
System.IO.TextWriter.WriteAsync(System.Char)
|
Improve this Doc
View Source
WriteAsync(Char[], Int32, Int32)
Declaration
public override Task WriteAsync(char[] buffer, int index, int count)
Parameters
Type |
Name |
Description |
System.Char[] |
buffer |
|
System.Int32 |
index |
|
System.Int32 |
count |
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Overrides
System.IO.TextWriter.WriteAsync(System.Char[], System.Int32, System.Int32)
|
Improve this Doc
View Source
WriteAsync(String)
Declaration
public override Task WriteAsync(string value)
Parameters
Type |
Name |
Description |
System.String |
value |
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Overrides
System.IO.TextWriter.WriteAsync(System.String)
|
Improve this Doc
View Source
WriteLine()
Declaration
public override void WriteLine()
Overrides
System.IO.TextWriter.WriteLine()
|
Improve this Doc
View Source
WriteLine(Boolean)
Declaration
public override void WriteLine(bool value)
Parameters
Type |
Name |
Description |
System.Boolean |
value |
|
Overrides
System.IO.TextWriter.WriteLine(System.Boolean)
|
Improve this Doc
View Source
WriteLine(Char)
Declaration
public override void WriteLine(char value)
Parameters
Type |
Name |
Description |
System.Char |
value |
|
Overrides
System.IO.TextWriter.WriteLine(System.Char)
|
Improve this Doc
View Source
WriteLine(Char[])
Declaration
public override void WriteLine(char[] buffer)
Parameters
Type |
Name |
Description |
System.Char[] |
buffer |
|
Overrides
System.IO.TextWriter.WriteLine(System.Char[])
|
Improve this Doc
View Source
WriteLine(Char[], Int32, Int32)
Declaration
public override void WriteLine(char[] buffer, int index, int count)
Parameters
Type |
Name |
Description |
System.Char[] |
buffer |
|
System.Int32 |
index |
|
System.Int32 |
count |
|
Overrides
System.IO.TextWriter.WriteLine(System.Char[], System.Int32, System.Int32)
|
Improve this Doc
View Source
WriteLine(Decimal)
Declaration
public override void WriteLine(decimal value)
Parameters
Type |
Name |
Description |
System.Decimal |
value |
|
Overrides
System.IO.TextWriter.WriteLine(System.Decimal)
|
Improve this Doc
View Source
WriteLine(Double)
Declaration
public override void WriteLine(double value)
Parameters
Type |
Name |
Description |
System.Double |
value |
|
Overrides
System.IO.TextWriter.WriteLine(System.Double)
|
Improve this Doc
View Source
WriteLine(Int32)
Declaration
public override void WriteLine(int value)
Parameters
Type |
Name |
Description |
System.Int32 |
value |
|
Overrides
System.IO.TextWriter.WriteLine(System.Int32)
|
Improve this Doc
View Source
WriteLine(Int64)
Declaration
public override void WriteLine(long value)
Parameters
Type |
Name |
Description |
System.Int64 |
value |
|
Overrides
System.IO.TextWriter.WriteLine(System.Int64)
|
Improve this Doc
View Source
WriteLine(Object)
Declaration
public override void WriteLine(object value)
Parameters
Type |
Name |
Description |
System.Object |
value |
|
Overrides
System.IO.TextWriter.WriteLine(System.Object)
|
Improve this Doc
View Source
WriteLine(Single)
Declaration
public override void WriteLine(float value)
Parameters
Type |
Name |
Description |
System.Single |
value |
|
Overrides
System.IO.TextWriter.WriteLine(System.Single)
|
Improve this Doc
View Source
WriteLine(String)
Declaration
public override void WriteLine(string value)
Parameters
Type |
Name |
Description |
System.String |
value |
|
Overrides
System.IO.TextWriter.WriteLine(System.String)
|
Improve this Doc
View Source
WriteLine(String, Object)
Declaration
public override void WriteLine(string format, object arg0)
Parameters
Type |
Name |
Description |
System.String |
format |
|
System.Object |
arg0 |
|
Overrides
System.IO.TextWriter.WriteLine(System.String, System.Object)
|
Improve this Doc
View Source
WriteLine(String, Object, Object)
Declaration
public override void WriteLine(string format, object arg0, object arg1)
Parameters
Type |
Name |
Description |
System.String |
format |
|
System.Object |
arg0 |
|
System.Object |
arg1 |
|
Overrides
System.IO.TextWriter.WriteLine(System.String, System.Object, System.Object)
|
Improve this Doc
View Source
WriteLine(String, Object, Object, Object)
Declaration
public override void WriteLine(string format, object arg0, object arg1, object arg2)
Parameters
Type |
Name |
Description |
System.String |
format |
|
System.Object |
arg0 |
|
System.Object |
arg1 |
|
System.Object |
arg2 |
|
Overrides
System.IO.TextWriter.WriteLine(System.String, System.Object, System.Object, System.Object)
|
Improve this Doc
View Source
WriteLine(String, Object[])
Declaration
public override void WriteLine(string format, params object[] arg)
Parameters
Type |
Name |
Description |
System.String |
format |
|
System.Object[] |
arg |
|
Overrides
System.IO.TextWriter.WriteLine(System.String, System.Object[])
|
Improve this Doc
View Source
WriteLine(UInt32)
Declaration
[CLSCompliant(false)]
public override void WriteLine(uint value)
Parameters
Type |
Name |
Description |
System.UInt32 |
value |
|
Overrides
System.IO.TextWriter.WriteLine(System.UInt32)
|
Improve this Doc
View Source
WriteLine(UInt64)
Declaration
[CLSCompliant(false)]
public override void WriteLine(ulong value)
Parameters
Type |
Name |
Description |
System.UInt64 |
value |
|
Overrides
System.IO.TextWriter.WriteLine(System.UInt64)
|
Improve this Doc
View Source
WriteLineAsync()
Declaration
public override Task WriteLineAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Overrides
System.IO.TextWriter.WriteLineAsync()
|
Improve this Doc
View Source
WriteLineAsync(Char)
Declaration
public override Task WriteLineAsync(char value)
Parameters
Type |
Name |
Description |
System.Char |
value |
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Overrides
System.IO.TextWriter.WriteLineAsync(System.Char)
|
Improve this Doc
View Source
WriteLineAsync(Char[], Int32, Int32)
Declaration
public override Task WriteLineAsync(char[] buffer, int index, int count)
Parameters
Type |
Name |
Description |
System.Char[] |
buffer |
|
System.Int32 |
index |
|
System.Int32 |
count |
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Overrides
System.IO.TextWriter.WriteLineAsync(System.Char[], System.Int32, System.Int32)
|
Improve this Doc
View Source
WriteLineAsync(String)
Declaration
public override Task WriteLineAsync(string value)
Parameters
Type |
Name |
Description |
System.String |
value |
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Overrides
System.IO.TextWriter.WriteLineAsync(System.String)
Implements
System.IDisposable
Extension Methods