Class ClrToSdlStream
public sealed class ClrToSdlStream : Stream, IDisposable
- Inheritance
-
ClrToSdlStream
- Implements
- Inherited Members
- Extension Methods
Remarks
Please note that operations on this stream are potentially throwing. They won't throw inevitably, but exceptions from the underlying CLR stream will propagate through this wrapper.
Constructors
ClrToSdlStream(Stream, bool)
Creates a new ClrToSdlStream instance wrapping the provided CLR Stream
public ClrToSdlStream(Stream clrStream, bool leaveOpen = false)
Parameters
clrStreamStreamThe CLR Stream to wrap
leaveOpenboolA value indicating whether to leave the underlying CLR stream open when this stream is disposed
Exceptions
- ArgumentNullException
clrStreamisnull
Properties
ClrStream
Gets the underlying CLR Stream
public Stream? ClrStream { get; }
Property Value
LengthCore
Gets the total length, in bytes, of the stream
protected override long LengthCore { get; }
Property Value
- long
The total length, in bytes, of the stream, or
-1on failure
- See Also
Methods
CloseCore()
Closes the stream and release associated resources
protected override bool CloseCore()
Returns
- See Also
-
TryClose()
Dispose(bool, bool)
Disposes the stream
protected override void Dispose(bool disposing, bool close)
Parameters
disposingboolA value indicating whether the call came from a call to Dispose() or from the finalizer
closeboolA value indicating whether the stream should be closed
Remarks
This method is not threadsafe.
- See Also
-
TryClose()
FlushCore(ref StreamStatus)
Flushes any buffered data in the stream
protected override bool FlushCore(ref StreamStatus status)
Parameters
statusStreamStatusThe StreamStatus of the stream. The value of the referenced StreamStatus could change on failure and should not necessarily change on success.
Returns
- See Also
-
TryFlush()
ReadCore(NativeMemory, ref StreamStatus)
Reads into specified data from the stream
protected override nuint ReadCore(NativeMemory data, ref StreamStatus status)
Parameters
dataNativeMemoryThe memory buffer to read data into
statusStreamStatusThe StreamStatus of the stream. The value of the referenced StreamStatus could change on failure and should not necessarily change on success.
Returns
- nuint
The number of bytes read from the stream
- See Also
SeekCore(long, StreamWhence)
Seeks within the stream
protected override long SeekCore(long offset, StreamWhence whence)
Parameters
offsetlongThe offset to seek to
whenceStreamWhenceThe reference point for the seek operation
Returns
- long
The absolute offset from the start of the stream after seeking, or
-1on failure
- See Also
WriteCore(ReadOnlyNativeMemory, ref StreamStatus)
Writes all specified data into the stream
protected override nuint WriteCore(ReadOnlyNativeMemory data, ref StreamStatus status)
Parameters
dataReadOnlyNativeMemoryThe memory buffer containing all the data to be written into the stream
statusStreamStatusThe StreamStatus of the stream. The value of the referenced StreamStatus could change on failure and should not necessarily change on success.
Returns
- nuint
The number of bytes read from the stream
- See Also