Impact Acquire SDK .NET
|
A helper class derived from System.IO.Stream used to read from and write to a file on a device. More...
Public Member Functions | |
DevFileStream (Device pDev, String fileName, System.IO.FileAccess access) | |
Constructs a new mv.impact.acquire.GenICam.DevFileStream object. | |
override void | Flush () |
Clears all buffers for this stream and causes any buffered data to be written to the underlying device. | |
override int | Read (byte[] buffer, int offset, int count) |
Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read. | |
override long | Seek (long offset, System.IO.SeekOrigin origin) |
Sets the position within the current stream. | |
override void | SetLength (long value) |
Sets the length of the current stream. | |
override void | Write (byte[] buffer, int offset, int count) |
Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written. | |
Properties | |
override bool | CanRead [get] |
Gets a value indicating whether the current stream supports reading. | |
override bool | CanSeek [get] |
Gets a value indicating whether the current stream supports seeking. | |
override bool | CanWrite [get] |
Gets a value indicating whether the current stream supports writing. | |
override long | Length [get] |
Gets the length in bytes of the stream. | |
override long | Position [get, set] |
Gets or sets the position within the current stream. | |
A helper class derived from System.IO.Stream used to read from and write to a file on a device.
This class encapsulates the functionality accessible using instances of mv.impact.acquire.GenICam.FileAccessControl in a much more convenient way.
Whenever a mv.impact.acquire.GenICam.DevFileStream instance is no longer needed Dispose must be called. Encapsulating stream access scopes with a using statement whenever possible is recommended:
Downloading a file UserFile from a GenICam device can be achieved like this:
Uploading a file UserFile to a GenICam device can be achieved like this:
|
inline |
Constructs a new mv.impact.acquire.GenICam.DevFileStream object.
[in] | pDev | A pointer to a mv.impact.acquire.Device object obtained from a mv.impact.acquire.DeviceManager object. |
[in] | fileName | The name of the file that shall be accessed. This can be any string returned by a call to mv.impact.acquire.EnumPropertyI<T>.listOfValidStrings() on the mv.impact.acquire.GenICam.FileAccessControl.fileSelector property. |
[in] | access | The desired file access. Only System.IO.FileAccess.Read and System.IO.FileAccess.Write are supported. Other values will raise a System.ArgumentException. |
Clears all buffers for this stream and causes any buffered data to be written to the underlying device.
Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
[in] | buffer | 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. |
[in] | offset | The zero-based byte offset in buffer at which to begin storing the data read from the current stream. |
[in] | count | The maximum number of bytes to be read from the current stream. |
Sets the position within the current stream.
Use the mv.impact.acquire.GenICam.DevFileStream.CanSeek property to determine whether the current instance supports seeking.
If offset
is negative, the new position is required to precede the position specified by origin
by the number of bytes specified by offset
. If offset
is zero (0), the new position is required to be the position specified by origin
. If offset
is positive, the new position is required to follow the position specified by origin
by the number of bytes specified by offset
.
[in] | offset | A byte offset relative to the origin parameter. |
[in] | origin | A value of type System.IO.SeekOrigin indicating the reference point used to obtain the new position. |
Sets the length of the current stream.
Calling this function will raise a System.NotSupportedException exception as the mv.impact.acquire.GenICam.FileAccessControl.fileSize property is not writeable.
Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
Use the mv.impact.acquire.GenICam.DevFileStream.CanWrite property to determine whether the current instance supports writing.
If the write operation is successful, the position within the stream advances by the number of bytes written. If an exception occurs, the position within the stream remains unchanged.
[in] | buffer | An array of bytes. This method copies count bytes from buffer to the current stream. |
[in] | offset | The zero-based byte offset in buffer at which to begin copying bytes to the current stream. |
[in] | count | The number of bytes to be written to the current stream. |
Gets a value indicating whether the current stream supports seeking.
If the device associated with this stream does not support the mv.impact.acquire.GenICam.FileAccessControl.fileAccessOffset property reading this property will raise a System.NotSupportedException exception.
Gets the length in bytes of the stream.
If the device associated with this stream does not support the mv.impact.acquire.GenICam.FileAccessControl.fileSize property reading this property will raise a System.NotSupportedException exception.
Gets or sets the position within the current stream.
If the device associated with this stream does not support the mv.impact.acquire.GenICam.FileAccessControl.fileAccessOffset property accessing this property will raise a System.NotSupportedException exception.