C# Class Helios.Buffers.AbstractReferenceCountedByteBuf

An abstract IByteBuf implementation that uses reference counting to protect the underlying data from being overwritten in scenarios where buffers are re-used, sliced, or otherwise shared.
Inheritance: Helios.Buffers.AbstractByteBuf
Show file Open project: helios-io/helios

Public Methods

Method Description
Release ( ) : bool
Release ( int decrement ) : bool
Retain ( ) : IReferenceCounted
Retain ( int increment ) : IReferenceCounted
Touch ( ) : IReferenceCounted
Touch ( object hint ) : IReferenceCounted

Protected Methods

Method Description
AbstractReferenceCountedByteBuf ( int maxCapacity ) : System.Diagnostics.Contracts
Deallocate ( ) : void

Called once ReferenceCount is equal to 0.

SetReferenceCount ( int refCount ) : void

An unsafe operation designed to be used by a subclass that sets the reference count of the buffer directly

Method Details

AbstractReferenceCountedByteBuf() protected method

protected AbstractReferenceCountedByteBuf ( int maxCapacity ) : System.Diagnostics.Contracts
maxCapacity int
return System.Diagnostics.Contracts

Deallocate() protected abstract method

Called once ReferenceCount is equal to 0.
protected abstract Deallocate ( ) : void
return void

Release() public method

public Release ( ) : bool
return bool

Release() public method

public Release ( int decrement ) : bool
decrement int
return bool

Retain() public method

public Retain ( ) : IReferenceCounted
return IReferenceCounted

Retain() public method

public Retain ( int increment ) : IReferenceCounted
increment int
return IReferenceCounted

SetReferenceCount() protected method

An unsafe operation designed to be used by a subclass that sets the reference count of the buffer directly
protected SetReferenceCount ( int refCount ) : void
refCount int The new value to use.
return void

Touch() public method

public Touch ( ) : IReferenceCounted
return IReferenceCounted

Touch() public method

public Touch ( object hint ) : IReferenceCounted
hint object
return IReferenceCounted