Interface IBlobReader
- Namespace
- RVZSharp.Interfaces
- Assembly
- RVZSharp.dll
A read-only disc image container (Dolphin: BlobReader). Implementations decode any of the supported formats on the fly and serve the original disc image bytes via ReadAt(long, Span<byte>).
public interface IBlobReader : IDisposable
- Inherited Members
Properties
BlockSize
Block size in bytes, or 0 for formats without blocks.
int BlockSize { get; }
Property Value
Length
Size of the decoded disc image in bytes.
long Length { get; }
Property Value
Type
The detected container format.
BlobType Type { get; }
Property Value
Methods
CopyTo(Stream, IProgress<double>?, int, CancellationToken)
Streams the decoded disc image like CopyTo(Stream, IProgress<double>?, CancellationToken),
optionally decoding on a worker pool. Only formats with a parallel decoder (RVZ/WIA)
use maxThreads; every other format decodes sequentially.
long CopyTo(Stream destination, IProgress<double>? progress, int maxThreads, CancellationToken cancellationToken = default)
Parameters
destinationStreamThe stream that receives the decoded image bytes.
progressIProgress<double>Optional progress reporter; receives a fraction in [0, 1] of the bytes decoded.
maxThreadsintDecoding threads: 0 uses the processor count, 1 forces sequential decoding. The output bytes are identical for any value.
cancellationTokenCancellationTokenCancellation is observed between reads.
Returns
- long
The number of bytes copied (the image length).
Exceptions
- ArgumentNullException
destinationis null.- RvzFormatException
Decoding stopped before the end of the image.
- OperationCanceledException
The operation was canceled.
CopyTo(Stream, IProgress<double>?, CancellationToken)
Streams the decoded disc image into destination in bounded blocks
(1 MiB per read), reporting progress and observing cancellation. Unlike
ReadFully(), this supports images of any size.
long CopyTo(Stream destination, IProgress<double>? progress = null, CancellationToken cancellationToken = default)
Parameters
destinationStreamThe stream that receives the decoded image bytes.
progressIProgress<double>Optional progress reporter; receives a fraction in [0, 1] of the bytes decoded.
cancellationTokenCancellationTokenCancellation is observed between reads.
Returns
- long
The number of bytes copied (the image length).
Exceptions
- ArgumentNullException
destinationis null.- RvzFormatException
Decoding stopped before the end of the image.
- OperationCanceledException
The operation was canceled.
CopyToAsync(Stream, IProgress<double>?, int, CancellationToken)
Asynchronous form of CopyTo(Stream, IProgress<double>?, int, CancellationToken). The decoders are synchronous and CPU-bound, so the work runs on the thread pool.
Task<long> CopyToAsync(Stream destination, IProgress<double>? progress, int maxThreads, CancellationToken cancellationToken = default)
Parameters
destinationStreamThe stream that receives the decoded image bytes.
progressIProgress<double>Optional progress reporter; receives a fraction in [0, 1] of the bytes decoded.
maxThreadsintDecoding threads: 0 uses the processor count, 1 forces sequential decoding. The output bytes are identical for any value.
cancellationTokenCancellationTokenCancellation is observed between reads.
Returns
Exceptions
- ArgumentNullException
destinationis null.- RvzFormatException
Decoding stopped before the end of the image.
- OperationCanceledException
The operation was canceled.
CopyToAsync(Stream, IProgress<double>?, CancellationToken)
Asynchronous form of CopyTo(Stream, IProgress<double>?, CancellationToken). The decoders are synchronous and CPU-bound, so the work runs on the thread pool; the returned task completes when the whole image has been streamed.
Task<long> CopyToAsync(Stream destination, IProgress<double>? progress = null, CancellationToken cancellationToken = default)
Parameters
destinationStreamThe stream that receives the decoded image bytes.
progressIProgress<double>Optional progress reporter; receives a fraction in [0, 1] of the bytes decoded.
cancellationTokenCancellationTokenCancellation is observed between reads.
Returns
Exceptions
- ArgumentNullException
destinationis null.- RvzFormatException
Decoding stopped before the end of the image.
- OperationCanceledException
The operation was canceled.
ReadAt(long, Span<byte>)
Reads buffer.Length.Length bytes of the decoded disc image at
position. Returns fewer bytes at the end of the image.
int ReadAt(long position, Span<byte> buffer)
Parameters
positionlongOffset into the decoded disc image.
bufferSpan<byte>The buffer to fill; its length is the number of bytes to read.
Returns
- int
The number of bytes read (fewer at the end of the image).
ReadFully()
Decodes the entire disc image into a byte array. For large images prefer streaming with CopyTo(Stream, IProgress<double>?, CancellationToken) so the image is never fully resident in memory.
byte[] ReadFully()
Returns
- byte[]
Exceptions
- RvzFormatException
The image is larger than 2 GiB (use CopyTo(Stream, IProgress<double>?, CancellationToken) for images that large).
ReadFully(IProgress<double>?, CancellationToken)
Decodes the entire disc image into a byte array, reporting progress and observing cancellation. For large images prefer streaming with CopyTo(Stream, IProgress<double>?, CancellationToken).
byte[] ReadFully(IProgress<double>? progress, CancellationToken cancellationToken = default)
Parameters
progressIProgress<double>Optional progress reporter; receives a fraction in [0, 1] of the bytes decoded.
cancellationTokenCancellationTokenCancellation is observed between reads.
Returns
- byte[]
The decoded disc image bytes.
Exceptions
- RvzFormatException
The image is larger than 2 GiB (use CopyTo(Stream, IProgress<double>?, CancellationToken) for images that large), or decoding stopped before the end of the image.
- OperationCanceledException
The operation was canceled.
ReadFullyAsync(IProgress<double>?, CancellationToken)
Asynchronous form of ReadFully(IProgress<double>?, CancellationToken). The decoders are synchronous and CPU-bound, so the work runs on the thread pool; the returned task completes when the image has been decoded.
Task<byte[]> ReadFullyAsync(IProgress<double>? progress = null, CancellationToken cancellationToken = default)
Parameters
progressIProgress<double>Optional progress reporter; receives a fraction in [0, 1] of the bytes decoded.
cancellationTokenCancellationTokenCancellation is observed between reads.
Returns
Exceptions
- RvzFormatException
The image is larger than 2 GiB (use CopyToAsync(Stream, IProgress<double>?, CancellationToken) for images that large).
- OperationCanceledException
The operation was canceled.