Faactory.Channels.Buffers 0.6.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Faactory.Channels.Buffers --version 0.6.1
NuGet\Install-Package Faactory.Channels.Buffers -Version 0.6.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Faactory.Channels.Buffers" Version="0.6.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Faactory.Channels.Buffers --version 0.6.1
#r "nuget: Faactory.Channels.Buffers, 0.6.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Faactory.Channels.Buffers as a Cake Addin
#addin nuget:?package=Faactory.Channels.Buffers&version=0.6.1

// Install Faactory.Channels.Buffers as a Cake Tool
#tool nuget:?package=Faactory.Channels.Buffers&version=0.6.1

Channels Buffers

A simple library to handle buffer reading and writing.

Design

An important fact on buffers, is that they were designed to work exclusively for reading or writing, not both. So, a buffer that IsReadable == true will be IsWritable == false and the other way around. This was a design decision and applies to both WrappedByteBuffer and WritableByteBuffer.

It is possible to interchange this behaviour by creating a writable buffer from a readable and vice-versa, by using the MakeReadOnly and MakeWritable extension methods.

Getting Started

When using Channels, you won't usually need to manually create a buffer instance, since you can interchange Byte[] and IByteBuffer types in the adapters. Nonetheless, if required, you can use WritableByteBuffer to create a writable buffer and a WrappedByteBuffer to create a readable buffer.

When reading data from a buffer, we have two distinct ways of doing so: by getting a value or by reading a value.

Getting a value from the buffer does not change the current buffer offset, but reading a value, moves the offset forward.

IByteBuffer buffer = ...;

// reads a byte at 'customOffset' without changing the buffer's offset
var b1 = buffer.GetByte( customOffset );

// reads a byte at the buffer's current offset and moves the offset 1 byte forward
var b2 = buffer.ReadByte();

Good to know...

  • The remaining readable bytes in the buffer are exposed by the ReadableBytes property.
  • Invoking DiscardReadBytes discards all read bytes (ReadXXX methods) and resets the offset
  • Invoking ResetOffset undoes previous readings and resets the offset
  • Invoking ToArray returns the entire buffer no matter where the buffer offset is
  • Except for the getting and reading methods, the buffer interface uses a fluent design
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Faactory.Channels.Buffers:

Package Downloads
Faactory.Channels.Abstractions

Channels

Faactory.Channels

Channels

Faactory.Channels.Core

Channels

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.10.0 165 4/9/2024
0.9.1 165 2/5/2024
0.9.0 223 1/30/2024
0.8.5 935 11/14/2023
0.8.4 100 11/13/2023
0.8.3 258 11/2/2023
0.8.2 116 11/1/2023
0.8.1 132 10/23/2023
0.8.0 153 10/20/2023
0.8.0-preview-1 97 10/19/2023
0.7.2-preview-1 102 10/12/2023
0.7.1 313 6/14/2023
0.7.0 560 4/11/2023
0.7.0-preview-3 140 2/7/2023
0.7.0-preview-2 134 2/7/2023
0.7.0-preview-1 138 2/7/2023
0.6.1 399 1/27/2023
0.6.0 369 1/27/2023
0.5.2 409 1/26/2023
0.5.1 738 1/24/2023
0.5.0 710 1/6/2023
0.4.0 1,034 11/21/2022
0.3.2 632 11/7/2022
0.3.1 879 7/14/2022
0.3.0 1,115 7/4/2022
0.2.0 615 6/10/2022
0.2.0-preview-1 170 6/10/2022
0.1.1 892 4/12/2022
0.1.0 1,121 4/12/2022
0.1.0-preview-9 189 4/8/2022
0.1.0-preview-7 180 4/7/2022
0.1.0-preview-6 153 3/31/2022
0.1.0-preview-5 212 3/29/2022
0.1.0-preview-4 163 3/29/2022
0.1.0-preview-3 144 3/28/2022
0.1.0-preview-11 401 4/12/2022
0.1.0-preview-10 199 4/11/2022