Class WindowsNetworkStream
Universal Windows Platform implementation of INetworkStream.
Inherited Members
Namespace: Dicom.Network
Assembly: cs.temp.dll.dll
Syntax
public sealed class WindowsNetworkStream : Stream, INetworkStream, IDisposable
Properties
CanRead
When overridden in a derived class, gets a value indicating whether the current stream supports reading.
Declaration
public override bool CanRead { get; }
Property Value
Type | Description |
---|---|
Boolean | true if the stream supports reading; otherwise, false. |
Overrides
CanSeek
When overridden in a derived class, gets a value indicating whether the current stream supports seeking.
Declaration
public override bool CanSeek { get; }
Property Value
Type | Description |
---|---|
Boolean | true if the stream supports seeking; otherwise, false. |
Overrides
CanWrite
When overridden in a derived class, gets a value indicating whether the current stream supports writing.
Declaration
public override bool CanWrite { get; }
Property Value
Type | Description |
---|---|
Boolean | true if the stream supports writing; otherwise, false. |
Overrides
Length
When overridden in a derived class, gets the length in bytes of the stream.
Declaration
public override long Length { get; }
Property Value
Type | Description |
---|---|
Int64 | A long value representing the length of the stream in bytes. |
Overrides
Exceptions
Type | Condition |
---|---|
NotSupportedException | A class derived from Stream does not support seeking. |
ObjectDisposedException | Methods were called after the stream was closed. |
LocalHost
Gets the local host of the network stream
Declaration
public string LocalHost { get; }
Property Value
Type | Description |
---|---|
String |
LocalPort
Gets the local port of the network stream.
Declaration
public int LocalPort { get; }
Property Value
Type | Description |
---|---|
Int32 |
Position
When overridden in a derived class, gets or sets the position within the current stream.
Declaration
public override long Position { get; set; }
Property Value
Type | Description |
---|---|
Int64 | The current position within the stream. |
Overrides
Exceptions
Type | Condition |
---|---|
IOException | An I/O error occurs. |
NotSupportedException | The stream does not support seeking. |
ObjectDisposedException | Methods were called after the stream was closed. |
RemoteHost
Gets the remote host of the network stream.
Declaration
public string RemoteHost { get; }
Property Value
Type | Description |
---|---|
String |
RemotePort
Gets the remote port of the network stream.
Declaration
public int RemotePort { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
AsStream()
Get corresponding Stream object.
Declaration
public Stream AsStream()
Returns
Type | Description |
---|---|
Stream | Network stream as Stream object. |
Dispose(Boolean)
Do the actual disposal.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
Boolean | disposing | True if called from Dispose(Boolean), false otherwise. |
Overrides
Remarks
The underlying stream is normally passed on to a DicomService implementation that is responsible for disposing the stream when appropriate. Therefore, the stream should not be disposed here.
Finalize()
Destrutor.
Declaration
protected void Finalize()
Flush()
When overridden in a derived class, clears all buffers for this stream and causes any buffered data to be written to the underlying device.
Declaration
public override async void Flush()
Overrides
Exceptions
Type | Condition |
---|---|
IOException | An I/O error occurs. |
Read(Byte[], Int32, Int32)
When overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
Declaration
public override int Read(byte[] buffer, int offset, int count)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | buffer | An array of bytes. When this method returns, the buffer contains the specified byte array with the values between |
Int32 | offset | The zero-based byte offset in |
Int32 | count | The maximum number of bytes to be read from the current stream. |
Returns
Type | Description |
---|---|
Int32 | The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached. |
Overrides
Exceptions
Type | Condition |
---|---|
ArgumentException | The sum of |
ArgumentNullException |
|
ArgumentOutOfRangeException |
|
IOException | An I/O error occurs. |
NotSupportedException | The stream does not support reading. |
ObjectDisposedException | Methods were called after the stream was closed. |
ReadAsync(Byte[], Int32, Int32, CancellationToken)
Asynchronously reads a sequence of bytes from the current stream, advances the position within the stream by the number of bytes read, and monitors cancellation requests.
Declaration
public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | buffer | The buffer to write the data into. |
Int32 | offset | The byte offset in |
Int32 | count | The maximum number of bytes to read. |
CancellationToken | cancellationToken | The token to monitor for cancellation requests. The default value is None. |
Returns
Type | Description |
---|---|
Task<Int32> | A task that represents the asynchronous read operation. The value of the |
Overrides
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentOutOfRangeException |
|
ArgumentException | The sum of |
NotSupportedException | The stream does not support reading. |
ObjectDisposedException | The stream has been disposed. |
InvalidOperationException | The stream is currently in use by a previous read operation. |
Seek(Int64, SeekOrigin)
When overridden in a derived class, sets the position within the current stream.
Declaration
public override long Seek(long offset, SeekOrigin origin)
Parameters
Type | Name | Description |
---|---|---|
Int64 | offset | A byte offset relative to the |
SeekOrigin | origin | A value of type SeekOrigin indicating the reference point used to obtain the new position. |
Returns
Type | Description |
---|---|
Int64 | The new position within the current stream. |
Overrides
Exceptions
Type | Condition |
---|---|
IOException | An I/O error occurs. |
NotSupportedException | The stream does not support seeking, such as if the stream is constructed from a pipe or console output. |
ObjectDisposedException | Methods were called after the stream was closed. |
SetLength(Int64)
When overridden in a derived class, sets the length of the current stream.
Declaration
public override void SetLength(long value)
Parameters
Type | Name | Description |
---|---|---|
Int64 | value | The desired length of the current stream in bytes. |
Overrides
Exceptions
Type | Condition |
---|---|
IOException | An I/O error occurs. |
NotSupportedException | The stream does not support both writing and seeking, such as if the stream is constructed from a pipe or console output. |
ObjectDisposedException | Methods were called after the stream was closed. |
Write(Byte[], Int32, Int32)
When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
Declaration
public override void Write(byte[] buffer, int offset, int count)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | buffer | An array of bytes. This method copies |
Int32 | offset | The zero-based byte offset in |
Int32 | count | The number of bytes to be written to the current stream. |
Overrides
Exceptions
Type | Condition |
---|---|
ArgumentException | The sum of |
ArgumentNullException |
|
ArgumentOutOfRangeException |
|
IOException | An I/O error occurred, such as the specified file cannot be found. |
NotSupportedException | The stream does not support writing. |
ObjectDisposedException | Write(Byte[], Int32, Int32) was called after the stream was closed. |
WriteAsync(Byte[], Int32, Int32, CancellationToken)
Asynchronously writes a sequence of bytes to the current stream, advances the current position within this stream by the number of bytes written, and monitors cancellation requests.
Declaration
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | buffer | The buffer to write data from. |
Int32 | offset | The zero-based byte offset in |
Int32 | count | The maximum number of bytes to write. |
CancellationToken | cancellationToken | The token to monitor for cancellation requests. The default value is None. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous write operation. |
Overrides
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentOutOfRangeException |
|
ArgumentException | The sum of |
NotSupportedException | The stream does not support writing. |
ObjectDisposedException | The stream has been disposed. |
InvalidOperationException | The stream is currently in use by a previous write operation. |