Faactory.Channels.Buffers
0.8.5
See the version list below for details.
dotnet add package Faactory.Channels.Buffers --version 0.8.5
NuGet\Install-Package Faactory.Channels.Buffers -Version 0.8.5
<PackageReference Include="Faactory.Channels.Buffers" Version="0.8.5" />
paket add Faactory.Channels.Buffers --version 0.8.5
#r "nuget: Faactory.Channels.Buffers, 0.8.5"
// Install Faactory.Channels.Buffers as a Cake Addin
#addin nuget:?package=Faactory.Channels.Buffers&version=0.8.5
// Install Faactory.Channels.Buffers as a Cake Tool
#tool nuget:?package=Faactory.Channels.Buffers&version=0.8.5
Channels - Buffers
A simple library to handle buffer reading and writing. Although this library was designed to work with Channels and is part of the same project, it does not depend on it and therefore, can be used independently.
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 one and vice-versa, by using the MakeReadOnly
and MakeWritable
extension methods.
Using Buffers
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 from a Byte[]
object.
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 reader offset, but reading a value, advances the offset by the number of bytes read.
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 by resetting the offset - Invoking
ToArray
returns the entire buffer no matter where the offset is - Except for the getting and reading methods, the buffer interface uses a fluent design
Product | Versions 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 is compatible. 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. |
-
net6.0
- No dependencies.
-
net7.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 |
---|---|---|
1.0.0-preview-4 | 0 | 6/26/2024 |
1.0.0-preview-3 | 0 | 6/26/2024 |
1.0.0-preview-2 | 0 | 6/26/2024 |
1.0.0-preview-1 | 24 | 6/26/2024 |
0.10.0 | 168 | 4/9/2024 |
0.9.1 | 166 | 2/5/2024 |
0.9.0 | 225 | 1/30/2024 |
0.8.5 | 939 | 11/14/2023 |
0.8.4 | 100 | 11/13/2023 |
0.8.3 | 261 | 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 | 561 | 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,035 | 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,122 | 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 |