Table of Contents

Class LazyFileStream

Namespace
Yarhl.IO.StreamFormat
Assembly
Yarhl.dll

Open file for reading or writing on the first operation (lazily).

public sealed class LazyFileStream : StreamWrapper, IAsyncDisposable, IDisposable
Inheritance
LazyFileStream
Implements
Inherited Members

Constructors

LazyFileStream(string, FileOpenMode)

Initializes a new instance of the LazyFileStream class.

public LazyFileStream(string path, FileOpenMode mode)

Parameters

path string

Path to the file.

mode FileOpenMode

Mode to open the file.

Properties

Length

Gets the length of this stream.

public override long Length { get; }

Property Value

long

Position

Gets or sets the position from the start of this stream.

public override long Position { get; set; }

Property Value

long

Methods

Read(byte[], int, int)

Reads from the stream to the buffer.

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

Parameters

buffer byte[]

Buffer to copy data.

offset int

Index to start copying in buffer.

count int

Number of bytes to read.

Returns

int

The number of bytes read.

ReadByte()

Reads the next byte.

public override int ReadByte()

Returns

int

The next byte.

SetLength(long)

Sets the length of the stream.

public override void SetLength(long value)

Parameters

value long

The new length of the stream.

Write(byte[], int, int)

Writes the a portion of the buffer to the stream.

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

Parameters

buffer byte[]

Buffer to write.

offset int

Index in the buffer.

count int

Bytes to write.

WriteByte(byte)

Writes a byte.

public override void WriteByte(byte value)

Parameters

value byte

Byte value.