Skip to content

Reference

OpcFileStream Members

Provides a Stream for a file node.

Reference

OpcFileStream Members ​

Type
OpcFileStream
Namespace
Opc.UaFx.Client
Assembly
Opc.UaFx.Advanced.dll
Package
Opc.UaFx.Advanced v2.59.0
Also in
Opc.UaFx.Client

Inherits members from Stream, MarshalByRefObject.

Constructors ​

OpcFileStream ​

3 overloads

OverloadDescription
OpcFileStream(OpcFileInfo, OpcFileMode)Initializes a new instance of the OpcFileStream class using the specified file and mode.
OpcFileStream(OpcFileNodeContext, OpcFileMode)Initializes a new instance of the OpcFileStream class using the specified context and mode.
OpcFileStream(OpcClient, OpcNodeId, OpcFileMode)Initializes a new instance of the OpcFileStream class using the specified client, fileNodeId and mode.

OpcFileStream(OpcFileInfo, OpcFileMode) ​

Initializes a new instance of the OpcFileStream class using the specified file and mode.

csharp
public OpcFileStream(OpcFileInfo file, OpcFileMode mode)
vbnet
Public Sub New(file As OpcFileInfo, mode As OpcFileMode)

Parameters

NameTypeDescription
fileOpcFileInfoThe OpcFileInfo of the file node to access.
modeOpcFileModeThe OpcFileMode to use to access the file node.

Exceptions

ExceptionCondition
ArgumentNullExceptionThe file is a null reference (Nothing in Visual Basic).

OpcFileStream(OpcFileNodeContext, OpcFileMode) ​

Initializes a new instance of the OpcFileStream class using the specified context and mode.

csharp
public OpcFileStream(OpcFileNodeContext context, OpcFileMode mode)
vbnet
Public Sub New(context As OpcFileNodeContext, mode As OpcFileMode)

Parameters

NameTypeDescription
contextOpcFileNodeContextThe OpcFileNodeContext of the file node to access.
modeOpcFileModeThe OpcFileMode to use to access the file node.

Exceptions

ExceptionCondition
ArgumentNullExceptionThe context is a null reference (Nothing in Visual Basic).

OpcFileStream(OpcClient, OpcNodeId, OpcFileMode) ​

Initializes a new instance of the OpcFileStream class using the specified client, fileNodeId and mode.

csharp
public OpcFileStream(OpcClient client, OpcNodeId fileNodeId, OpcFileMode mode)
vbnet
Public Sub New(
    client As OpcClient,
    fileNodeId As OpcNodeId,
    mode As OpcFileMode)

Parameters

NameTypeDescription
clientOpcClientThe OpcClient to use to access the file node.
fileNodeIdOpcNodeIdThe OpcNodeId of the file node to access.
modeOpcFileModeThe OpcFileMode to use to access the file node.

Exceptions

ExceptionCondition
ArgumentNullExceptionThe client or fileNodeId is a null reference (Nothing in Visual Basic).

Properties ​

CanRead ​

override

Gets a value indicating whether the current stream supports reading.

csharp
public override bool CanRead { get; }
vbnet
Public Overrides ReadOnly Property CanRead As Boolean

Property value

Boolean

The value true if the stream supports reading; otherwise the value false.

Overrides

CanRead

Remarks

If the stream is closed, this property returns false.

CanSeek ​

override

Gets a value indicating whether the current stream supports seeking.

csharp
public override bool CanSeek { get; }
vbnet
Public Overrides ReadOnly Property CanSeek As Boolean

Property value

Boolean

The value true if the stream supports seeking; otherwise the value false.

Overrides

CanSeek

Remarks

If the stream is closed, this property returns false.

CanWrite ​

override

Gets a value indicating whether the current stream supports writing.

csharp
public override bool CanWrite { get; }
vbnet
Public Overrides ReadOnly Property CanWrite As Boolean

Property value

Boolean

The value true if the stream supports writing; otherwise the value false.

Overrides

CanWrite

Remarks

If the stream is closed, this property returns false.

File ​

Gets the OpcFileInfo used to determine the file accessibility and its size.

csharp
public OpcFileInfo File { get; }
vbnet
Public ReadOnly Property File As OpcFileInfo

Property value

OpcFileInfo

The OpcFileInfo used by the OpcFileStream object.

Handle ​

Gets a SafeOpcFileHandle object that represents the file handle for the file that the current OpcFileStream object encapsulates.

csharp
public SafeOpcFileHandle Handle { get; }
vbnet
Public ReadOnly Property Handle As SafeOpcFileHandle

Property value

SafeOpcFileHandle

An object that represents the file handle for the file that the current OpcFileStream object encapsulates or a null reference (Nothing in Visual Basic) then the file stream has been disposed of or closed.

Length ​

override

Gets the length in bytes of the stream.

csharp
public override long Length { get; }
vbnet
Public Overrides ReadOnly Property Length As Long

Property value

Int64

A long value representing the length of the stream in bytes.

Exceptions

ExceptionCondition
ObjectDisposedExceptionThe stream has been disposed of.

Overrides

Length

Position ​

override

Gets or sets the position within the current stream.

csharp
public override long Position { get; set; }
vbnet
Public Overrides Property Position As Long

Property value

Int64

The current position within the stream.

Exceptions

ExceptionCondition
ObjectDisposedExceptionThe stream has been disposed of.

Overrides

Position

Methods ​

Close ​

override

Closes the current stream and releases any resources associated with the current stream. Instead of calling this method, ensure that the stream is properly disposed.

csharp
public override sealed void Close()
vbnet
Public NotOverridable Overrides Sub Close()

Overrides

Close()

Remarks

Attempts to manipulate the stream after the stream has been closed might throw an ObjectDisposedException.

Flush ​

override

Clears all buffers for this stream and causes any buffered data to be written to the underlying device.

csharp
public override void Flush()
vbnet
Public Overrides Sub Flush()

Overrides

Flush()

Read ​

override

Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.

csharp
public override int Read(byte[] buffer, int offset, int count)
vbnet
Public Overrides Function Read(
    buffer As Byte(),
    offset As Integer,
    count As Integer) As Integer

Parameters

NameTypeDescription
bufferByte[]An array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the current source.
offsetInt32The zero-based byte offset in buffer at which to begin storing the data read from the current stream.
countInt32The maximum number of bytes to be read from the current stream.

Returns

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.

Exceptions

ExceptionCondition
ArgumentExceptionThe sum of offset and count is larger than the buffer length.
ArgumentNullExceptionThe buffer is a null reference (Nothing in Visual Basic).
ArgumentOutOfRangeExceptionThe offset or count is negative.
NotSupportedExceptionThe stream does not support reading.
ObjectDisposedExceptionThe stream has been disposed of.

Overrides

Read(byte[], int, int)

Remarks

Use the CanRead property to determine whether the current instance supports reading.

Seek ​

override

Sets the position within the current stream.

csharp
public override long Seek(long offset, SeekOrigin origin)
vbnet
Public Overrides Function Seek(offset As Long, origin As SeekOrigin) As Long

Parameters

NameTypeDescription
offsetInt64A byte offset relative to the origin parameter.
originSeekOriginA value of type SeekOrigin indicating the reference point used to obtain the new position.

Returns

Int64

The new position within the current stream.

Exceptions

ExceptionCondition
NotSupportedExceptionThe stream does not support seeking.
ObjectDisposedExceptionThe stream has been disposed of.

Overrides

Seek(long, SeekOrigin)

Remarks

Use the CanSeek property to determine whether the current instance supports seeking. Seeking to any location beyond the length of the stream is supported.

SetLength ​

override

Sets the length of the current stream.

csharp
public override void SetLength(long value)
vbnet
Public Overrides Sub SetLength(value As Long)

Parameters

NameTypeDescription
valueInt64The desired length of the current stream in bytes.

Exceptions

ExceptionCondition
ObjectDisposedExceptionThe stream has been disposed of.
NotSupportedExceptionThe stream does not support both writing and seeking.

Overrides

SetLength(long)

Remarks

Use the CanWrite property to determine whether the current instance supports writing, and the CanSeek property to determine whether seeking is supported. If the specified value is less than the current length of the stream, the stream is truncated. If the specified value is larger than the current length of the stream, the stream is expanded. If the stream is expanded, the contents of the stream between the old and the new length are not defined.

Write ​

override

Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

csharp
public override void Write(byte[] buffer, int offset, int count)
vbnet
Public Overrides Sub Write(
    buffer As Byte(),
    offset As Integer,
    count As Integer)

Parameters

NameTypeDescription
bufferByte[]An array of bytes. This method copies count bytes from buffer to the current stream.
offsetInt32The zero-based byte offset in buffer at which to begin copying bytes to the current stream.
countInt32The number of bytes to be written to the current stream.

Exceptions

ExceptionCondition
ArgumentExceptionThe sum of offset and count is larger than the buffer length.
ArgumentNullExceptionThe buffer is a null reference (Nothing in Visual Basic).
ArgumentOutOfRangeExceptionThe offset or count is negative.
NotSupportedExceptionThe stream does not support writing.
ObjectDisposedExceptionThe stream has been disposed of.

Overrides

Write(byte[], int, int)

Remarks

Use the CanWrite property to determine whether the current instance supports writing.