Skip to main content

TinyFileStream Class

Namespace: GHIElectronics.TinyCLR.IO.TinyFileSystem · Assembly: GHIElectronics.TinyCLR.IO.TinyFileSystem

Provides a stream for a file in the Tiny File System.

public class TinyFileStream : Stream

Properties

CanRead

public override bool CanRead { get; }

Gets a value indicating whether the current stream supports reading.

CanSeek

public override bool CanSeek { get; }

Gets a value indicating whether the current stream supports seeking.

CanWrite

public override bool CanWrite { get; }

Gets a value indicating whether the current stream supports writing.

Length

public override long Length { get; }

Gets length of bytes in the stream.

Position

public override long Position { get; set; }

Gets or sets the current possition in the stream.

Methods

Flush()

public override void Flush()

Writes unwritten data to the file.

Read(byte[] array, int offset, int count)

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

Reads a block of bytes from the stream.

ParameterTypeDescription
arraybyte[]The array to fill with the data read from the file.
offsetintThe byte offset in the array at which read bytes will be placed.
countintThe maximun number of bytes to read.

Returns int

Seek(long offset, SeekOrigin origin)

public override long Seek(long offset, SeekOrigin origin)

Sets the current position of this stream to a given value.

ParameterTypeDescription
offsetlongThe offset of the positon relative to the origin.
originSeekOriginSpecified the beginning, end or current postion as a reference point to apply the offset.

Returns long — The new postion in the stream.

SetLength(long value)

public override void SetLength(long value)

Sets the length of this stream to a given value.

ParameterTypeDescription
valuelongThe new length of the stream

Write(byte[] array, int offset, int count)

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

Writes a block of bytes to the file stream.

ParameterTypeDescription
arraybyte[]The buffer containing the data to write to the stream.
offsetintThe byte offset in the array from which to start writing bytes to the stream.
countintThe number of bytes to write.

Dispose(bool disposing)

protected override void Dispose(bool disposing)

Dispose the TinyFileStream.

ParameterTypeDescription
disposingbooltrue if being disposed from a call to Dispose otherwise false if called from the finalizer.