Easy.IO
1.0.0
See the version list below for details.
dotnet add package Easy.IO --version 1.0.0
NuGet\Install-Package Easy.IO -Version 1.0.0
<PackageReference Include="Easy.IO" Version="1.0.0" />
paket add Easy.IO --version 1.0.0
#r "nuget: Easy.IO, 1.0.0"
// Install Easy.IO as a Cake Addin #addin nuget:?package=Easy.IO&version=1.0.0 // Install Easy.IO as a Cake Tool #tool nuget:?package=Easy.IO&version=1.0.0
Easy.IO
Based on okio project built with .Net Standard 2.0
ByteStrings and Buffers
Easy.IO is built around two types that pack a lot of capability into a straightforward API:
[ByteString][3] is an immutable sequence of bytes. For character data,
String
is fundamental.ByteString
is String's long-lost brother, making it easy to treat binary data as a value. This class is ergonomic: it knows how to encode and decode itself as hex, base64, and UTF-8.[EasyBuffer][4] is a mutable sequence of bytes. Like
List
, you don't need to size your buffer in advance. You read and write buffers as a queue: write data to the end and read it from the front. There's no obligation to manage positions, limits, or capacities.
Internally, ByteString
and EasyBuffer
do some clever things to save CPU and
memory. If you encode a UTF-8 string as a ByteString
, it caches a reference to
that string so that if you decode it later, there's no work to do.
EasyBuffer
is implemented as a linked list of segments. When you move data from
one buffer to another, it reassigns ownership of the segments rather than
copying the data across. This approach is particularly helpful for multithreaded
programs: a thread that talks to the network can exchange data with a worker
thread without any copying or ceremony.
Get started
- Read File
string tempFile = Path.GetTempFileName();
BufferedSource source = EasyIO.Buffer(EasyIO.Source(tempFile));
var str = source.ReadUtf8();
source.Dispose();
- Write File
string tempFile = Path.GetTempFileName();
BufferedSink sink = EasyIO.Buffer(EasyIO.Sink(tempFile));
sink.WriteUtf8("Hello, ");
sink.Dispose();
- Append File
string tempFile = Path.GetTempFileName();
BufferedSink sink = EasyIO.Buffer(EasyIO.Sink(tempFile, FileMode.Append));
sink.WriteUtf8("Hello, ");
sink.Dispose();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- SharpZipLib (>= 1.1.0)
- System.IO.Pipelines (>= 4.5.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.