CompoundStreamNotFoundException Class
Definition
- Assembly
- Bodu.IO.Compound.dll
- Package
- Bodu.IO.Compound 1.0.0
The exception thrown when a named stream is requested from a compound file but no matching directory entry exists.
public sealed class CompoundStreamNotFoundException : CompoundFileException, ISerializable
- Inheritance
-
CompoundStreamNotFoundException
- Implements
- Inherited Members
- Extension Methods
Examples
Catch the exception when a stream is expected to exist, or switch to the Try pattern when its absence is a
normal outcome:
try
{
CompoundStream entry = file.RootStorage.OpenStream("Workbook");
}
catch (CompoundStreamNotFoundException ex)
{
Console.WriteLine($"Missing stream: {ex.StreamName}");
}
// Non-throwing alternative:
if (file.RootStorage.TryOpenStream("Workbook", out CompoundStream? workbook))
{
// ...
}
Remarks
Thrown by OpenStream(string) and OpenStorage(string). Callers that prefer a non-throwing lookup should use TryOpenStream(string, out CompoundStream) or TryOpenStorage(string, out CompoundStorage) instead. It derives from CompoundFileException, the common base for all compound-file failures.
Constructors
CompoundStreamNotFoundException()
Initializes a new instance of the CompoundStreamNotFoundException class.
public CompoundStreamNotFoundException()
CompoundStreamNotFoundException(string)
Initializes a new instance of the CompoundStreamNotFoundException class with the specified message.
public CompoundStreamNotFoundException(string message)
Parameters
messagestringA message that describes the lookup failure.
CompoundStreamNotFoundException(string, Exception)
Initializes a new instance of the CompoundStreamNotFoundException class with the specified message and a reference to the underlying cause.
public CompoundStreamNotFoundException(string message, Exception innerException)
Parameters
Properties
StreamName
Gets the name of the stream that was requested but not found, when known.
public string? StreamName { get; }
Property Value
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |