Skip to main content

RawStream Class

NuGet: GHIElectronics.TinyCLR.Devices.UsbClient
Assembly: GHIElectronics.TinyCLR.Devices.UsbClient
Namespace: GHIElectronics.TinyCLR.Devices.UsbClient

USB stream for reading and writing data through two endpoints.

public class RawStream : Stream

Constructors​

RawStream(int streamIndex, RawDevice parent)​

public RawStream(int streamIndex, RawDevice parent)

Creates a new raw stream.

Properties​

NullEndpoint​

public static int NullEndpoint { get; }

Represents no endpoint.

StreamIndex​

public int StreamIndex { get; }

The index of this stream.

ReadTimeout​

public override int ReadTimeout { get; set; }

How long to wait before timing out a read operation.

WriteTimeout​

public override int WriteTimeout { get; set; }

How long to wait before timing out a write operation.

CanRead​

public override bool CanRead { get; }

Whether or not read is allowed from the stream.

CanSeek​

public override bool CanSeek { get; }

Whether or not seeking is allowed in the stream.

CanWrite​

public override bool CanWrite { get; }

Whether or not writting is allowed to the stream.

Length​

public override long Length { get; }

Not supported.

Position​

public override long Position { get; set; }

Not supported.

LastWritten​

public int LastWritten { get; set; }

The number of bytes successfully written in the last call to any Write function.

BytesToRead​

public int BytesToRead { get; }

The number of bytes available to read.

BytesToWrite​

public int BytesToWrite { get; }

The number of bytes that are in the process of being written.

Methods​

Seek(long offset, SeekOrigin origin)​

public override long Seek(long offset, SeekOrigin origin)

Not supported.

ParameterTypeDescription
offsetlongNot supported.
originSeekOriginNot supported.

Returns long — Not supported.

SetLength(long value)​

public override void SetLength(long value)

Not supported.

ParameterTypeDescription
valuelongNot supported.

Flush()​

public override void Flush()

Flushs the USB write buffers.

Read(byte[] buffer, int offset, int count)​

public override int Read(byte[] buffer, int offset, int count)

Reads data from the stream.

ParameterTypeDescription
bufferbyte[]The buffer to read into.
offsetintThe offset into the buffer at which to write the data.
countintThe number of bytes to read.

Returns int — The number of bytes read.

Write(byte[] buffer, int offset, int count)​

public override void Write(byte[] buffer, int offset, int count)

Writes data to the stream.

ParameterTypeDescription
bufferbyte[]The buffer from which to write.
offsetintThe offset into the buffer at which to begin writing.
countintThe number of bytes to write.

Read(byte[] buffer)​

public int Read(byte[] buffer)

Reads data from the stream.

ParameterTypeDescription
bufferbyte[]The buffer into which to read.

Returns int — The number of bytes read.

Write(byte[] buffer)​

public void Write(byte[] buffer)

Writes data to the stream.

ParameterTypeDescription
bufferbyte[]The buffer from which to write.

Dispose(bool disposing)​

protected override void Dispose(bool disposing)

Disposes the object.

ParameterTypeDescription
disposingboolWhether or not this is called from Dispose.