C# Class NanoByte.Common.Streams.CircularBufferStream

A circular buffer represented as a stream that one producer can write to and one consumer can read from simultaneously.
Do not use more than one producer or consumer thread simultaneously!
Inheritance: Stream
Mostra file Open project: nano-byte/common Class Usage Examples

Public Methods

Method Description
CircularBufferStream ( int bufferSize ) : System

Creates a new circular buffer.

DoneWriting ( ) : void

Signals that no further calls to Write are intended and any blocked Read calls should return.

Flush ( ) : void
Read ( byte buffer, int offset, int count ) : int
RelayErrorToReader ( Exception exception ) : void

Throws an exception from within Read.

Seek ( long offset, SeekOrigin origin ) : long
SetLength ( long value ) : void

Sets the estimated number of bytes that will run through this buffer in total; -1 for unknown.

Write ( byte buffer, int offset, int count ) : void

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Method Details

CircularBufferStream() public method

Creates a new circular buffer.
public CircularBufferStream ( int bufferSize ) : System
bufferSize int The maximum number of bytes the buffer can hold at any time.
return System

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void

DoneWriting() public method

Signals that no further calls to Write are intended and any blocked Read calls should return.
public DoneWriting ( ) : void
return void

Flush() public method

public Flush ( ) : void
return void

Read() public method

public Read ( byte buffer, int offset, int count ) : int
buffer byte
offset int
count int
return int

RelayErrorToReader() public method

Throws an exception from within Read.
public RelayErrorToReader ( Exception exception ) : void
exception System.Exception The exception to throw.
return void

Seek() public method

public Seek ( long offset, SeekOrigin origin ) : long
offset long
origin SeekOrigin
return long

SetLength() public method

Sets the estimated number of bytes that will run through this buffer in total; -1 for unknown.
public SetLength ( long value ) : void
value long
return void

Write() public method

public Write ( byte buffer, int offset, int count ) : void
buffer byte
offset int
count int
return void