Easy.IO 1.0.0

A modern I/O API for Net Standard 2.0

There is a newer version of this package available.
See the version list below for details.
Install-Package Easy.IO -Version 1.0.0
dotnet add package Easy.IO --version 1.0.0
<PackageReference Include="Easy.IO" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Easy.IO --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Easy.IO, 1.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// 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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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();

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();

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.5.0 270 12/14/2019
1.3.0 224 7/21/2019
1.0.0 207 7/7/2019